Maintaining State issue with Virtual Scrolling

6 posts, 0 answers
  1. Bob
    Bob avatar
    138 posts
    Member since:
    Sep 2012

    Posted 09 Feb 2015 Link to this post

    I had previously created a gridstatemanager that stores the state of our grids, including filter, sort, page, etc. 

    I based the code on an example that you guys published. http://www.telerik.com/support/code-library/save-grid-state-in-session-on-server-side

    We are having a problem in that the "page" is stored in session, and when queried, that page of data is returned, but the grid doesn't realize it is on that page.

    I switched the code to use the newly added getOptions/setOptions and the same issue occurs. 

    Questions.

    1. Is there a way to tell the grid what page of data it is on? There is no way to scroll "up" if not on page one, and also, if we scroll down, the grid just requests page 1.

    2. I switched the code to use the getOptions/setOptions. The same paging issue occurs. Also, when I use setOptions, my grids header disappears when I call setOptions. Why would this happen?

    3. In your sample originally used, the code is taking any date filers and making parsing the date. I assume this is because the date is stored as a string once you stringify it. Does setOptions automatically take care of this?

    4. If your sample your code shows it does a setOptions and the filtered data occurs after pressing the "load options" button. Is this sample using remote data or local data? When I do setOptions no query occurs and I still have to call the datasource.Read(). 


  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 11 Feb 2015 Link to this post

    Hello Bob,

    I am afraid there is not way to set initial page when when virtual scrolling is enabled. Initial page can only be set when using the regular pager. The virtual scroller is designed to be one directional i.e. you can scroll it and change the dataSource.page but if you change the dataSource.page the scroller won't be scrolled accordingly.

    Kind Regards,
    Petur Subev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Bob
    Bob avatar
    138 posts
    Member since:
    Sep 2012

    Posted 11 Feb 2015 in reply to Petur Subev Link to this post

    That's kind of what I thought you would say about the page position.

    What about the issue with date parsing and setOptions and the fact that my header disappears?
  5. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 13 Feb 2015 Link to this post

    Hello Bob,

    My apologies for the late reply on the other questions:

    3) when you use getOptions the filter expressions contain a Date field as value, indeed stringifying them is a problem which you should parse back manually, the setOptions method expects the options of the dataSource to be as they were retrieved through the getOptions method.

    4) The following demo uses remote data. If the AutoBind option of the Grid is set to true, then after setting the options of the Grid you should not perform any read request. Please demonstrate your case so we see what is the issue that you struggle with.

    Kind Regards,
    Petur Subev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Bob
    Bob avatar
    138 posts
    Member since:
    Sep 2012

    Posted 13 Feb 2015 in reply to Petur Subev Link to this post

    Thanks, do you have an example of "fixing" the dates before setting the options to setOptions? I assume the code is similar to that other sample, the filters are just in a slightly different location in the options objects.

    So, that's the difference, we have autobind set to false, because we have code in our common document ready that binds to every grid, checks for settings in sessionStorage, and then calls the dataSource's read(). Good enough.

    I still don't know why the header toolbar disappears, I will attempt to create a sample. 

  7. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 17 Feb 2015 Link to this post

    Hello Bob,

    We do not have such example that demonstrates the serialization of Date objects. You can search the net for similar questions and create your own serialization format if the default one does not behave as expected. 

    Kind Regards,
    Petur Subev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready