Project

General

Profile

Bug #3977

Problems with closing a dialog after WServer::post

Added by Alan Finley about 7 years ago. Updated about 7 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
04/13/2015
Due date:
% Done:

0%

Estimated time:

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?

#1

Updated by Alan Finley about 7 years ago

I use Wt 3.3.1.

#2

Updated by Wim Dumon about 7 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.

#3

Updated by Alan Finley about 7 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.

Also available in: Atom PDF