PDA

View Full Version : [Solved]grid state restore via button



p3p3
9 Feb 2010, 5:10 AM
Hi again,

how can i restore/rest the grid state by pressing a button? I have try follow:


// store the state obj (trigger on test button)
var objState = grid.getState();
This is my restore.button event handler:


Ext.state.Manager.set('statedepotgrid',objState);
grid.fireEvent('beforestaterestore', grid, objState);
grid.fireEvent('staterestore', grid, objState); // 4 try only
gridt.view.refresh(true);
...but nohting happen. Where is the mistake:-?

thx in advace
p3p3

PS.: stats cant be saved on server side.

p3p3
9 Feb 2010, 5:51 AM
Try this one :D


grid.applyState( stateGrid );
grid.view.refresh(true);

p3p3

PS.: can be closed

frrogoy
9 Feb 2010, 7:08 AM
HI, Not sure if this is what you're asking for, but I have found it helpful to users to give them a button in the fbar to restore the state of the grid to where it was initially.

},'-',{
id: 'grid-clear-cookie',
text: 'Clear Preferences',
handler: function(){
Ext.state.Manager.clear('po-grid');
window.location="poext.php"; // refresh the page
}
},

p3p3
10 Feb 2010, 12:13 AM
@frrogoy: thx 4 your help, but my second post is the right deal.