1
votes

I created the following code to create a modal dialog: it is works until it is closed. After closing - the page from where this was called stops responding. Unable to click inside any text box / click any button at all.

var app = UiApp.createApplication(); var dialog = app.createDialogBox().setModal(true).setText('Record Saved').setPopupPosition(200, 200).show(); var closeHandler = app.createClientHandler().forTargets(dialog).setVisible(false); var button= dialog.setWidget(app.createButton('Ok').addClickHandler(closeHandler)); app.add(dialog); return app;

Is there something amiss with that code?

Edit:

I amended the code as follows:

Removed the following line:

var app = UiApp.createApplication();

Revised code looks as follows:


var dialog = app.createDialogBox().setModal(true).setText('Record Saved').setPopupPosition(200, 200).show(); var closeHandler = app.createClientHandler().forTargets(dialog).setVisible(false); var button= dialog.setWidget(app.createButton('Ok').addClickHandler(closeHandler)); app.add(dialog); return app;

The current situation is that the freezing issue is resolved now. The new issue is that the Modal design is gone. The dialog appears at the bottom. Functionality is fine - it is just that modality is gone.

Will continue the search and keep all of us posted. Thank you.

Update:

Improvement in code - hides only the button and not dialog

var dialog = app.createDialogBox().setModal(true).setPopupPosition(200, 200).show(); var closeHandler = app.createClientHandler() .forEventSource() .setVisible(false); var savebutton = dialog.setWidget(app.createButton("Record Saved").addClickHandler(closeHandler));

1

1 Answers

0
votes

This did the trick. Thanks Team.

app.createDialogBox().setModal(true).setPopupPosition(200, 200).setAutoHideEnabled(true).setText("Record Saved").show();