Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear the grid in Extjs

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.

like image 663
Java Learner Avatar asked Jul 24 '13 11:07

Java Learner


1 Answers

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!

like image 188
Mike Avatar answered Sep 24 '22 15:09

Mike