Retain grid state on page load

2 posts, 0 answers
  1. Logan
    Logan avatar
    61 posts
    Member since:
    Apr 2013

    Posted 06 Nov 2017 Link to this post

    Here is what I am trying to achieve in a nutshell:

     

    User filters/sorts grid in whatever way they desire. User leaves page and comes back to said grid in the same state that it was left in. Is there any way to do this through event handlers/without using buttons?

     

    Thanks!

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2480 posts

    Posted 07 Nov 2017 Link to this post

    Hello Logan,

    I assembled a small sample that illustrates how you can implement the functionality. The state for the Grid is persisted in the beforeunload event handler. This way any operations performed by the users before leaving the page will be persisted. 

    In order to restore the state you can use the document.ready event. Make sure that you check if there is anything persisted beforehand to avoid script errors.  

    The sample below illustrates the approach. It is using the Kendo UI jQuery Grid, however, the relevant code for persisting the state will be the same when using the MVC wrapper.



    Regards,
    Viktor Tachev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top