Project

General

Profile

show a container widget in a new tab

Added by Anonymous over 6 years ago

Hi everybody,

I want to show a container widget in a new tab.

for doing so, I added a new entry point to an existing WServer object.

the type of this entry point is "WidgetSet" and a new path is set for it. the considered path is also set for a WAnchor object.

Although in creating the application the intended container widget is binded to the application object, the container content can not be shown,when the link is clicked.

in other words, instead of the intended container, some text is shown in the new browser tab.

how can I have a new WApplication to show the container in a new tab or how can I show a container widget in a new tab ??

my code:

server->addEntryPoint(Wt::WidgetSet,createApplication1,"/reportxyz");

WLink link;

link.setUrl("/reportxyz");

repo_anchor = new WAnchor(link,"Get Report");

repo_anchor->setTarget(Wt::TargetNewWindow);

Wt::WApplication * createApplication1(const Wt::WEnvironment& env)

{

Wt::WApplication *app = new Wt::WApplication(env);

app->bindWidget(new_report_container, "app");

return app;

}

in the above code, new_report_container is the container which I want to show in a new tab.


Replies (1)

RE: show a container widget in a new tab - Added by Wim Dumon over 6 years ago

Hello Samira,

That not the intended use of Wt's WidgetSet mode.

For what you describe, you have two possible solutions:

- check env->internalPath() at construction of the application, and render the correct contents. Use this if the new window should essentially show a specific 'page' of the same application.

  • alternatively, deploy a second application on the same WServer. That is what almost what you do in the code example you posted, but just call app~~root()~~>addWidget(...) instead of bindWidget()

WidgetSet mode is used when you want to integrate a Wt application inside a webpage, much in the same way as you can integrate google maps in a webpage.

Best regards,

Wim.

    (1-1/1)