简体   繁体   中英

Extjs 3.4 reload grid after remove records

In Extjs 3.4 I am removing some records from a JsonStore using the remove() method. After I save the pending changes by calling the save() method. In the db the delete is executed, so records are removed but in the front-end I see the records just removed.

gridStore.remove(checkColumn.getSelections());
gridStore.save(); //calling the server.

after the save() the grid is not reloaded.

How can I reload the grid after the save?

After performing a .remove() your record should be removed from your grid automatically. But -- if you want to reload the store after your save then just add a save listener to your store and fire .load() :

listeners: {
    save: function(store, batch, data) {
        store.load();
    }
}

http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.data.Store-event-save

if you want to reload your data, you must see the changes. I means, put this codes together:

Ext.getCmp('idMyGrid').getStore().load();
Ext.getCmp('idMyGrid').getView().refresh();

This it's work for me. I hope that works for you too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM