This is a migrated thread and some comments may be shown as answers.

Saving the sorting/filtering/grouping/paging state of a grid

7 Answers 1895 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 21 Oct 2013, 08:53 PM
So we have a requirement that the user be able to save the state of the grid they are working on and then at a later time when they come back to that page the state would be the same... Meaning if they were to sort ascending by the column "State" and then group by the column "City"... when that user comes back to that grid it should look the same as when they left it.  We are planning on doing this via either a save to a database or a session variable, but my question is what is the best way to save these settings?
1.) How do I build up some sort of object that contains the settings for the grid...
2.) How do I pass those settings back into the grid when they come back to the page.

Thanks,
Jason

7 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 23 Oct 2013, 01:18 PM
Hello Jason,


Please take a look at the following Code Library - Preserve Grid state in a cookie, which demonstrates a sample approach to save and then apply the state of the Grid on later stage.


Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joe
Top achievements
Rank 1
answered on 03 Mar 2014, 04:24 PM
This seems like a significant gap in what should be out-of-the-box functionality for the grid.

The sample you provided requires quite a bit of analysis to figure out how every last aspect needs to be implemented.  And it's made even more difficult since there isn't any documentation included with it.

If there is a less-convoluted and/or better-documented source for getting a grid to recall the user's last state for filters, sorting, columns, paging, etc..., I and probably many others would be very grateful.
Even better would be to hear that built-in functionality for this has been released.
0
Dimiter Madjarov
Telerik team
answered on 04 Mar 2014, 10:10 AM
Hi Joe,


This approach is not documented anywhere, because as you stated, at the moment it is not part of the built in functionality of the Grid. At the moment, the development team is not planing to add it as such.

Please let me know if you are experiencing any concrete issues with the example, so I could assist you further.

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ries
Top achievements
Rank 1
answered on 05 Dec 2014, 06:14 PM
Dimiter,

thanks for that post, however, is there not a sort of more re-usable way? With your example we have to add a lot of code to each datagrid, besides that there is no way of storing this information somewhere unless we hack your code.
Is there not a way to do this more like how angular works?
0
Dimiter Madjarov
Telerik team
answered on 08 Dec 2014, 12:26 PM
Hello Ries,


From the Q3 2014  release, the Grid has a built in functionality for saving and loading it's state. You could check it in the following demo.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ries
Top achievements
Rank 1
answered on 08 Dec 2014, 11:11 PM
Dimiter,

somewhat related to this I am using the following code to test if my datagrid is ready in angular:

$scope.$watch('kendogrid', function (newValue, oldValue) {
  if (newValue) {
     // do something with my kendogrid
  }
})

However, when I use angular router and go away from the controller and then come back I noticed that my kendo data grid variable $scope.kendogrid isn't set. It seems to be set just once during pageload, not anymore after my controller loads for a second time.

I noticed that kendo does use a huge global variable called 'kendo' so I am wondering if the data grid does remember if it was initialised somewhere in that global grid and doesn't set the scope variable anymore?
If so, is there a way to 'reset' this somehow?
 


0
Dimiter Madjarov
Telerik team
answered on 10 Dec 2014, 10:02 AM
Hello Ries,


The suggested approach in the current case would be to use the kendoWidgetCreated event. Regarding the kendo variable is not related to the scenario, it only stores some general configurations and information like the current Kendo version.

If further assistance is required, please send us a support ticket or open a separate forum thread, as the topic is not directly related to saving/loading the Grid state. Thanks in advance for the cooperation.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Joe
Top achievements
Rank 1
Ries
Top achievements
Rank 1
Share this question
or