View Full Version : Reload parent grid on closing child - Need Help

17 Aug 2009, 11:38 PM
I have data in a grid and a link in each of the rows that opens up a pop up to show detailed information. The user can edit the information in that pop up and click on save. Once the user clicks save, and then closes the child window, i want to be able to refresh the grid data in the parent.

am very new to ExtJS and any help would be highly appreciated.


18 Aug 2009, 12:59 AM
The way i do it is when i create the new window i add a listener for the "close" event and then tell the parent grid to refresh in the function. Something like...

var win = new Ext.Window...

win.on({ scope: this,
close: function(){


Hope this helps...

18 Aug 2009, 1:32 AM
While the first suggested solution works perfectly fine, it will reload the whole grid when you actually updated only one record.
In case of simple grids with small nr of data reloading everything is ok. But you could identify the record that has been updated and update only the record that you modified and update that one:

function updateStoreRecord(objectId, newValue1, newValue2, newValue3){
var recordIndex = store.findBy(function(record){
return record.get('objectId') == objectId;
var updatedRecord = store.getAt(recordIndex);

updatedRecord.set('prop1', newValue1);
updatedRecord.set('prop2', newValue2);
updatedRecord.set('prop3', newValue3);

var waitBox = parent.Ext.MessageBox.wait('Saveing data', 'Save');
url: url('saveUrl.do'),
params: {objId : myObjId,
param1: newValue1,
param2: newValue2,
param3: newValue3
success: function(result, request) {
updateStoreRecord(myObjId, newValue1, newValue2, newValue3);
failure: function(response) {
var messageText = 'Save has failed with the following statusCode:' + response.status;

title: 'Error',
msg: messageText,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR

NOTE that updating a record from the store behind the grid will trigger the refresh of that row on the grid.