PDA

View Full Version : How to remove a grid item from a window



Yemi
8 Oct 2013, 4:51 AM
I window has one item inside which is an xtype of a grid, how can I remove this grid when I click on the close button for the window and then add the grid back when I render the window again.

willigogs
8 Oct 2013, 6:05 AM
You can achieve this in many different ways.

For example:
http://jsfiddle.net/Whinters/GY5bV/1/

Yemi
8 Oct 2013, 7:48 AM
Thanks willigogs,you have always been so helpful, but what I wanted to do was to remove the grid from the window and place it back into the window

Yemi
8 Oct 2013, 8:09 AM
var actwindow = new Ext.Window({
title:'test'
height:300,
closeAction:'hide',
width: 400,
plain:true,
layout:'fit',

items: [{
xtype:'grid'
}],


});


actwindow.show();


Also, I do not want the grid item to be destroyed, I just want to remove it when you close the window and re render the grid when i call this function again.

willigogs
8 Oct 2013, 8:13 AM
In that case, why bother removing the grid at all? You may as well just allow the window to be hidden and then shown again without doing anything to the grid at all?

I assume what you're trying to achieve is to reset the grid back to it's original state - which you could also achieve by simply re-loading the store with it's original data (although any sort order, etc would be retained)?