Bug #3977
openProblems with closing a dialog after WServer::post
0%
Description
I have a dialog that contains a link to some resource. I want the dialog to be closed after the resource is downloaded.
Here's my resource code:
void MyResource::handleRequest(const Wt::Http::Request &request, Wt::Http::Response &response)
{
...
_finished.emit();
}
Wt::Signal<>& MyResource::finished()
{
return _finished;
}
And this is how I use it in my dialog:
...
resource = new MyResource(this);
resource->finished().connect(this, &MyDialog::onExportFinished);
...
void MyDialog::onExportFinished()
{
Wt::WServer::instance()->post(sessionId, // <- session id is saved in the dialog ctor
boost::bind(&MyDialog::closeDialog, this));
}
void MyDialog::closeDialog()
{
accept();
wApp->triggerUpdate();
}
My web application class is based on WQApplication and has enableUpdates
set to true
.
The problem is that the dialog is not closed in Firefox. Other browser does not have problems with it.
Am I doing something wrong?
Updated by Wim Dumon almost 9 years ago
- Status changed from New to Feedback
Alan,
This looks good in principle - indeed you must post the signal to your session. Is the response in JavaScript the same on FF as on the other browsers? Any error reported in the JS console?
Best regards,
Wim.
Updated by Alan Finley almost 9 years ago
I don't get any errors in the JS console.
How can I check the response in Javascript?
Also I've noticed that in FF dialog is closed when I perform any action after the resource download is completed. For example I check a radio button and the dialog closes.