Hi,
I am doing a quick investigation regarding the saving of a controls state. Mainly a Grid control.
What i am after is information about a user changing the column order, sort order, hiding/showing columns, etc. And then having these changes saved somewhere (locally most likely) so when they return to the page, these changes persist.
Thanks for your help.
Simon Gould
I am doing a quick investigation regarding the saving of a controls state. Mainly a Grid control.
What i am after is information about a user changing the column order, sort order, hiding/showing columns, etc. And then having these changes saved somewhere (locally most likely) so when they return to the page, these changes persist.
Thanks for your help.
Simon Gould
10 Answers, 1 is accepted
0
Gary
Top achievements
Rank 1
answered on 11 Jan 2012, 01:57 PM
Any luck? I would also like to see some information on this topic.
0
Hi,
Atanas Korchev
the Telerik team
A possible solution is to get the current state of the datasource and persist it in a cookie or post it to the server. Here is an example showing how to get the grid state:
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 2
answered on 05 Sep 2012, 07:36 PM
I'm getting a 404 on the JS FIddle on this page... can you repost?
-John-
-John-
0
John
Top achievements
Rank 2
answered on 27 Feb 2013, 03:29 PM
Any follow up on this jsfiddle? I am still wondering how to maintain column order.
-john-
-john-
0
Hello,
Atanas Korchev
the Telerik team
The idea is to use the grid's dataSource API to get the state. The pageSize(), page(), sort(), filter(), group() methods can be used for this purpose. Here is an example: http://jsbin.com/erefug/1/edit
Regards,Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 2
answered on 04 Mar 2013, 01:03 PM
Just following up, Thanks! That is a perfect example.
-john-
-john-
0
Steve
Top achievements
Rank 1
answered on 29 Apr 2013, 09:07 PM
Hello, thank you for this information.
Is there other documentation on saving the Grid State; i.e. saving information about the columns themselves? I think the first question should be, can Column State information on the grid be retrieved similar to the methods listed in Atanas Korchev's very informative posting; pageSize(), page(), sort(), filter(), group()? I do not see similar functions for retrieving Column information.
I'm most interested in retrieving the Columns that the user has set (via the columnMenu) to show on the Grid and also the Order that the user has arranged the columns in and the column width. I want to be able to save this grid state Column information when the user exits the grid and then be able to re-load that same state when the user opens the grid again.
Any help on this is much appreciated.
Even knowing if any of these things is possible would be of great help.
(1) retrieving the "columns" that the user has "shown" on the grid (one's they checked on the columnMenu)
(2) retrieving the "order" of the columns that the user has set
(3) retrieving the "width" of the columns that the user has set
Thank you very much, --Steve
Is there other documentation on saving the Grid State; i.e. saving information about the columns themselves? I think the first question should be, can Column State information on the grid be retrieved similar to the methods listed in Atanas Korchev's very informative posting; pageSize(), page(), sort(), filter(), group()? I do not see similar functions for retrieving Column information.
I'm most interested in retrieving the Columns that the user has set (via the columnMenu) to show on the Grid and also the Order that the user has arranged the columns in and the column width. I want to be able to save this grid state Column information when the user exits the grid and then be able to re-load that same state when the user opens the grid again.
Any help on this is much appreciated.
Even knowing if any of these things is possible would be of great help.
(1) retrieving the "columns" that the user has "shown" on the grid (one's they checked on the columnMenu)
(2) retrieving the "order" of the columns that the user has set
(3) retrieving the "width" of the columns that the user has set
Thank you very much, --Steve
0
Hi Steve,
Atanas Korchev
the Telerik team
You can use the columns field of the grid to get the column state. Here is a live demo showing the same: http://jsbin.com/ilahuh/1/edit
Kind regards,Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 2
answered on 30 Apr 2013, 02:00 PM
@Steve,
Regarding Column Order:
The order is based on the way the columns are inserted into the datasource. The way I have seen it done is that you check an index of the column and loop through them and splice/push into the column array.
Regarding the size: you can use the columns that Atanas suggested and apply the query for that object
yourgrid.data('kendoGrid').dataSource.query(yourColumnProperties);
Note on the size: If you have fixed width for ALL of the columns, it will not look right, because nothing is a percentage. It is recommended that you have at least one column based on a percentage so it can fill your column width.
Hope this helps.
-john-
Regarding Column Order:
The order is based on the way the columns are inserted into the datasource. The way I have seen it done is that you check an index of the column and loop through them and splice/push into the column array.
Regarding the size: you can use the columns that Atanas suggested and apply the query for that object
yourgrid.data('kendoGrid').dataSource.query(yourColumnProperties);
Note on the size: If you have fixed width for ALL of the columns, it will not look right, because nothing is a percentage. It is recommended that you have at least one column based on a percentage so it can fill your column width.
Hope this helps.
-john-
0
Steve
Top achievements
Rank 1
answered on 30 Apr 2013, 02:49 PM
Thank you very much Atanas and John for those replies, they help quite a lot! I will be using your information today to get something working. If you happen to find any similar information regarding this, posting something about it here will be very much appreciated. Thank you very much for your help!
Best regards,
Steve Hill
Best regards,
Steve Hill