Page reload after the user closed a jQueryUi Dialog

I load a update form into a jQueryUi dialog using the Yii extension quickdlgs.

After I close the dialog, the CGridView on the parent page gets refreshed as expected.

But in my form there I added a button, to call another action when the user clicked on it. This request now renders its view inside the dialog window.

Since that action deletes a record, the parent page should automatically be refreshed. Now the user has to click F5 everytime after that action, otherwise the deleted record does not disappear ???

here is quick fix, register a callback for deleteButton


$('#deleteButton').on('click', function() {

    window.location.reload();

});

There are few events that Jquary ui diealog is firing : close and beforeClose.

http://api.jqueryui.com/dialog/#event-close

U should use them to add page reload on one of those events. Basically it’s what TDD already suggested just not attaching event on delete button but using dialog configuration.

I tried something. Nothing does the job:


$url = Yii::app()->createAbsoluteUrl('sammelhefte/admin');

Yii::app()->clientScript->registerScript('closeDialog',"

    $('#convertButton').click(function() {

//    window.parent.location.href='".$url."';

//    setTimeout((function() { window.parent.location.reload('true');}), 5000);

      window.top.location.reload(true);

});",CClientScript::POS_READY);

why don’t you just reload the main window

I added JavaScript Code to the saveButton of the target view in the form displayed in the dialog.

I found for the id of the dialog and used it to close it:


$url = Yii::app()->createAbsoluteUrl('sammelhefte/admin');

Yii::app()->clientScript->registerScript('save',"

    $('#submitButtonMultimodel').click(function() {

        window.top.jQuery('#sammelhefte-grid_c8updateWdgt-dlg').dialog('close');

        // window.top.$.fn.yiiGridView.update('sammelhefte-grid');

        window.top.location.href='".$url."';

    });",CClientScript::POS_READY);

Now the dialog is closed after click on the save Button and I get redirected but the record is not saved.

Now I consider that it is not useful to load a second view into the dialog and therefore I give it up … :-[