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

[Solved] Persist Ajax grid filters on refresh

1 Answer 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sean
Top achievements
Rank 1
Sean asked on 30 Apr 2012, 07:15 PM
Hello,

I have a grid that uses ajax binding and the GridOperationMode.Client and i am trying to get the grid to preserve the filtering, sorting, grouping, and ColumnContextMenu changes when a user manually refreshes the pages (i.e. F5). Since none of the values get added to the route data because the actions are client side the refresh always erases any user changes to the grid.  I do not want to switch to the server side actions since it takes a significant amount of time (4+ seconds) to gather the grid's data (since the data spans across several database tables) and with normal operation mode every single action would send a new request. 

I have played around with using the url hash to store the values and have javascript do the work for me when the grid loads but i have had mixed results.  The grid.sortBy property appears to drive the sorting as expected, when i pass it the sorting string the grid appears to key off it when generating the grid.  However the grid.filterBy and grid.groupBy attributes appear to not work that way.

Is there any way to set the filtering, sorting, grouping, and ColumnContextMenu values before the grid loads and have the grid perform a single data binding using javascript?

Thanks,

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 01 May 2012, 07:20 AM
Hi Sean,

To persist the changes made to the Grid component when using Ajax binding you can use the approach shown in this code library article. 

Greetings,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Grid
Asked by
Sean
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or