-
4 Apr 2009 3:50 AM #1
How can i save Grid state using GXT?
How can i save Grid state using GXT?
Hi,
Is it possible to save grid sort and grouping state in to coockies or in DB?
There lot's of solutions on this grid save state but all are in GWT Ext i.e. using Ext JS Javascript solutions. Not in GXT.
In GXT There are some classes at com.extjs.gxt.ui.client.state this location. These are StateManager, Provider and CoockieProvider. Using this i think it is possible.
I have tried some approaches using these classes but it doesn't work?
please help, thanks in advance.
-
9 Apr 2009 6:41 AM #2
Save State using Cookie Provider
Save State using Cookie Provider
Hi,
Follwoing is the code that i had tried save State of Grid in GXT using CookieProvieder class.
I created object cookie added some values.
SaveState is object having getter setter for some propertied.
CookieProvider cookie = new CookieProvider(null, null ,null, true);
SaveState state = new SaveState();
state.setStateId("1");
state.setColId("2");
state.setSortDir(grid.getStore().getSortField());
cookie.set("stateId", state);
But not getting how to fetch this object cookie on load of Grid to reset state.
Please help if any one having idea about save state using CookieProvider.Last edited by Rupesh; 9 Apr 2009 at 6:46 AM. Reason: title
-
29 May 2009 4:47 AM #3
To store states in a database, you must provide a specific provider to the StateManager (The default provider is CookieProvider). The best way is to create a RpcStateProvider.
Create a new class which implements Provider abstract class. Then create a new instance of this class and then set it to the StateManager:
The difficulty : RpcStateProvider is by definition asynchronous (RPC call). When your application or GXT callCode:StateManager.get().setProvider(new RpcStateProvider());
the result is supposed to be the value of your state. With RpcStateProvider the result is always null. So you have to provide a asynchronous callback which is responsible of setting the value to the correct widget.Code:StateManager.get().get("mystatename");
I've done such provider and a PreferenceManager window which is able to save user interface preferences (typically a grid preference : column visibility, grouping, column order, ...) to a XML file on the server side. Currently I have to refactor my code to separate our specific code.
-
5 Aug 2009 3:57 AM #4
need your help on grid state storing
need your help on grid state storing
Hi Rupesh,
I am also looking for the grid state save stuff.
I think by this time you got the solution. Can you please share with me how you have achieved?
Regards
Ram
-
4 Dec 2009 11:29 AM #5
Hi etaix,
I need to do some thing similar. I need to save the state of the Grid in database or xml file. So, if a user deletes a column from Grid, the next time when he generates the grid I don't want to display the column that was deleted from the Grid. Can you please provide me a sample code or example on how to do this?
Thanks,
Mahesh
-
17 Jan 2011 4:31 AM #6
Hi,
I need to save the state of the Grid in database using java . Can you please provide me a sample code or example on how to do this?
Thanks
Sachin.


Reply With Quote