Reputation: 321
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.
Upvotes: 6
Views: 23431
Reputation: 11
var usrStore = Ext.StoreManager.lookup('LES.ossi.ossi-sampleapp.store.MainStore');
usrStore.removeAll();
Upvotes: 0
Reputation: 1
This worked for me:
Ext.ComponentQuery.query('#yourGrid')[0].getStore().removeAll();
Hope it helps.
Upvotes: 0
Reputation: 1013
Make sure you are using:
grid.getStore().remove(record); //remove record from grid
grid.getStore().sync(); //sync with server
If you want to remove all items, do:
grid.getStore().removeAll();
grid.getStore().sync();
But be careful! That will delete everything!
Upvotes: 17