Update parent after children new windows closed

Update parent after children new windows closed

Here is a snippet to update parent after new window getting closed :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Start trigger pop-up new window
var createUrl = $(this).data('url') + selectedUUID;
newwindow = window.open(createUrl, 'Some Page, 'scrollbars=yes,resizable=yes,height=600,width='+screen.width/2);

// Set focus on windows
if (window.focus) {
    newwindow.focus();
}

// Update parent once children window already closed
// Reload jqgrid table to get latest data
var monitor = setInterval(function() {
    if (newwindow.closed) {
         // Update children table
         $selectorFarmfield.setGridParam({url: 'someurl' + selectedUUID});
         $selectorFarmfield.trigger("reloadGrid");
         clearInterval(monitor);
    }
}, 1000);

Leave a Reply

Your email address will not be published. Required fields are marked *