6

I have a GridStore in Extjs which can store records with two grid columns. I have a problem when one record exists in Grid, if i delete the grid its been deleted successfully in server side, but that still exists in Grid.

Sample code:

    xtype: 'grid',
    store: 'SampleStore',
    border: false,
    width : 542,
    ref: '../sampleGrid',
    id: 'sampleGrid',
    columns: [
       {
       xtype: 'gridcolumn',
       dataIndex: 'name',
       header: 'Name',
       sortable: true,
   .............
    view: new Ext.grid.GridView({
    forceFit: true
    })

Thanks for help in advance.

4

2 回答 2

16

确保您正在使用:

grid.getStore().remove(record); //remove record from grid
grid.getStore().sync(); //sync with server

如果要删除所有项目,请执行以下操作:

grid.getStore().removeAll();
grid.getStore().sync();

但小心点!那将删除所有内容!

于 2013-07-24T11:37:29.700 回答
0

这对我有用:

Ext.ComponentQuery.query('#yourGrid')[0].getStore().removeAll();

希望能帮助到你。

于 2014-07-16T16:42:45.487 回答