I am attempting to setup a Kendo Grid in AJAX mode, but have some sort of history feature with the browser. This is so that if the user has sorted/paged the grid then clicks another link then hit's the browser back button to come back to the grid, that they will be given the same set of data they were looking at when they left.
I don't really care about storing every step of the paging/sorting in the browser history (although this is an option), I'm more just interested in doing so when the user clicks on a link that that takes them to a whole new page. Imagine a search screen with the grid, where a user clicks on a search result, discovers it's not what they were looking for, then presses the back button to get back to the results he was looking at.
I know I could use server side mode of the grid for this, but AJAX appears to be alot faster and I would like to optimize for this performance.
Through my investigation so far, it seems I have some options on how this could be done:
1. Use the new HTML5 history api
To use this I would need to build up the query string for the paging/sorting and then store that into the browser history. I could probably do this on the databound event of the grid. Question on this one would be, is there any way to ask the grid for the query string? It obviously knows how to build it because it does so in server mode. It would be nice not having to recreate this code.
2. Using ASP.NET MVC Session
It seems like I could store some of the paging/sorting information into the session and then retrieve it. But I would only want it to take effect when the user has pressed the back button. If they press the Results link directly, it should just go to the default first page, no sorting grid. Only when they press back should they get the paging/sorting they were using before they left the page. Does anyone have any idea on how to accomplish this?
3. Using cookies
Seems like the same basic idea as #2 with the same questions
Any help or ideas would be greatly appreciated!
I don't really care about storing every step of the paging/sorting in the browser history (although this is an option), I'm more just interested in doing so when the user clicks on a link that that takes them to a whole new page. Imagine a search screen with the grid, where a user clicks on a search result, discovers it's not what they were looking for, then presses the back button to get back to the results he was looking at.
I know I could use server side mode of the grid for this, but AJAX appears to be alot faster and I would like to optimize for this performance.
Through my investigation so far, it seems I have some options on how this could be done:
1. Use the new HTML5 history api
To use this I would need to build up the query string for the paging/sorting and then store that into the browser history. I could probably do this on the databound event of the grid. Question on this one would be, is there any way to ask the grid for the query string? It obviously knows how to build it because it does so in server mode. It would be nice not having to recreate this code.
2. Using ASP.NET MVC Session
It seems like I could store some of the paging/sorting information into the session and then retrieve it. But I would only want it to take effect when the user has pressed the back button. If they press the Results link directly, it should just go to the default first page, no sorting grid. Only when they press back should they get the paging/sorting they were using before they left the page. Does anyone have any idea on how to accomplish this?
3. Using cookies
Seems like the same basic idea as #2 with the same questions
Any help or ideas would be greatly appreciated!