PDA

View Full Version : [CLOSED] GridPanel - state for columns



PatrikG
Apr 13, 2012, 12:21 PM
Hi,

I can't find any example discribing/showing how to maintain changes a user might do to column in a gridpanel.
I would like to store settings from a gridpanel in a database/server.
If the user changes size, sortorder, closes on colum this change should be saved in a table.
I can find an example on how to save a certain state in a cookie, http://examples1.ext.net/#/DragDrop/Advanced/Drag_with_State/ ,
but nothing on how to do this on gridpanel.

Can you, please, describe how to do this?


/PatrikG

Daniil
Apr 13, 2012, 12:54 PM
Hi,

Please read the Docs article of the stateful config option.
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.state.Stateful-cfg-stateful

PatrikG
Apr 13, 2012, 1:43 PM
Is there a way to get this event triggered server side?

I've tried the following:


this.GridPanel.Stateful = true;
this.GridPanel.StateEvents = new string[] { "columnresize", "columnmove", "columnvisible", "columnsort" };
this.GridPanel.StateID = "ABC";
this.GridPanel.StateChanged +=new EventHandler(GridPanel_StateChanged);


I'm not sure that its the gridPanels state I want to be listen to capture changes on columns?!

And added:

<customConfig> <ext:ConfigItem Name="stateful" Value="true" Mode="Raw" /></CustomConfig>
to the grid in markup.

The stateProvider is set as:

<ext:ResourceManager ID="ResourceManager1" runat="server" StateProvider="PostBack"/>


/PAtrik

Daniil
Apr 13, 2012, 1:48 PM
It should be done client side.

Though you always can get a client side data on server passing it from client and otherwise.

Generally, many things are saved by default in GridPanel. So, you can start from this default functionality.

You can get GridPanel state on client:

GridPanel1.getState();
to save it on server.

Then you can apply this saved state using the applyState method.

GridPanel1.applyState(stateFromDatabase);