PDA

View Full Version : [CLOSED] persisting the customized columns in Razor view



gets_gui
Jan 08, 2013, 3:02 PM
Hi,

We have a grid and users can move around the columns based on their preference.
Can you advise that if there any way we can persist those info and reload based on the user login?

Thanks,

Daniil
Jan 08, 2013, 3:53 PM
Hi @gets_gui,

1. Save the columns state somewhere, for example, to a database using an AJAX request (DirectEvent or DirectMethod).

You can send the columns state as a request parameter.

You can do it when a user clicks some "Save" button. To get the columns state you can use the GridPanel's getState method.

App.GridPanel1.getState()

It returns something like:

{
"columns": [{
"id": "Column1"
}, {
"id": "Column2",
"width": 138
}, {
"id": "Column3"
}]
}

Or handling the GridPanel's ColumnMove event.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.panel.Table-event-columnmove

2. On view creation time send the state from the controller to the view and create the GridPanel columns accordingly.

gets_gui
Jan 08, 2013, 4:07 PM
Great, will try it out.
Thanks!