Best practice for loading and saving grid settings to avoid reloading all the data from the grid a second time

4 posts, 0 answers
  1. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 01 Feb 2012 Link to this post

    Hi,

    I'm using your PersistanceFramework to save and restore settings from a grid in a WCF RIA Services project. The gris is the Telerik GridView.

    The problem I have is that the grid loads a lot of data which makes everything a bit slow. The issue I get is that my grid loads all the data a first time and then when I restore the grid settings it just seems that everything is reloaded... Which makes sense in a way when the restored setting is a filter or a sort order...

    To see my code please see here:
    http://www.telerik.com/community/forums/silverlight/persistence-framework/store-persistencemanager-to-isolatedstorage.aspx 

    Do you have a recommendation of what could be done to avoid that double loading? Maybe something like first restoring the grid settings and then with some kind of property descriptors magic, influence my query so that the result does correspond to what is expected by the grid? I'm talking without knowing as you can guess from what I say ;)

    Any help would be really appreciated.

    John.
     
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 06 Feb 2012 Link to this post

    Hi John,

    Can you please elaborate a bit more on your scenario? You said that in your application it seems that restoring the RadGridView settings causes a data reload, but the PersistenceManager shouldn't force the WCF Service to query the data for the RadGridView again. And this is why I was wondering if the RadGridView refreshes as though reloading its data or it is actually loading the data again from the WCF Service.

    I am asking you because there are scenarios in which the loading of persisted RadGridView filter settings, may be delayed and it looks as though the RadGridView's data is refreshed. But from your description it seems that you're not persisting sort or filter descriptors. This is why we'll need more information on the RadGridView properties that you're persisting and the scenario you're implementing.

    Also, if you can modify the sample solution I attached in your other thread to reproduce this issue, that would greatly help us.

    Regards,
    Tina Stancheva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 06 Feb 2012 Link to this post

    Hi Tina,
    Thanks for jumping in this one too ;)

    I am actually storing and restoring sort, firlter and groups... I'm using the code found here :
    http://demos.telerik.com/silverlight/#PersistenceFramework/GridViewCustomSerialization 

    You can see that in that code when the settings are restored, the sort, filters and groups are cleared which is forcing a reload.
    I disabled those just to keep saving columns visibility, order and width which is working great.

    I restoring the settings at control_loaded... is this too late? Shall I do this in the page constructor instead?

    Modifying the sample will be time consuming because I will have to remove everything from my big project.

    I guess that the correct way of doing this is create the page, restore the control settings and only then build my query to load the data using the sort and co descriptors from the grid. I was trying this before even trying to save/restore the settings but never managed to make it work... I will stop using the gridview anyway. It's been nearly two years that I work on my project and the insert row is still not working reliably in some cases. I'm a bit desapointed but this is something else...

    For now, let's say that I'm happy without sorting filtering and grouping... it's slow enought anyway already...

    Thanks a lot for your kind help,
    John.

  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 09 Feb 2012 Link to this post

    Hello John,

    At the moment when you load the persisted filter/sorting/grouping settings of the RadGridView during the application load, the RadGridView data is refreshed. It is refreshed as the RadGridView data is loaded and then the persisted filter/sort/group settings are applied. However, we are not aware of any workarounds for this issue.

    Also, you can't persist the filter/sort/group/column settings before the RadGridView data has loaded as the custom property provider depends on the data loaded in the RadGridView to apply the restored settings - it basically needs to access the generated columns and apply the persisted settings on them.

    Kind regards,
    Tina Stancheva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top