PDA

View Full Version : Reset/clear grid completely



sencha.user
22 Nov 2012, 11:40 PM
Hi,

How do we reset a grid completely? I tried,


Ext.getCmp('grid_id').getStore().removeAll();

It doesn't remove column header in the grid. Is there any other way?

Thanks in advance!

Farish
23 Nov 2012, 12:01 AM
depends on what you mean by reset and what you want to do with it after reset. the reconfigure method of the grid might do the work for you:

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.Panel-method-reconfigure

you can pass no store and an empty columns array. the title and other configs of the grid would remain as it is i would guess.

sencha.user
23 Nov 2012, 12:02 AM
I did it myself hyding the whole grid when not necessary,


Ext.get('grid_id').hide();

sencha.user
23 Nov 2012, 12:04 AM
Hi Farish,

I tried that, since the columns are set initially in run time, column headers are not getting removed. Thanks for your input :).