unexpected ItemsLoading calls

6 posts, 0 answers
  1. Eric Lincoln
    Eric Lincoln avatar
    18 posts
    Member since:
    Jul 2009

    Posted 16 Dec 2010 Link to this post

    Hi Telerik Team,

    I'm using your new VirtualQueryableCollectionView (Q3 SP1 beta) with RadGridView for SL.
    I notice that when the scrollbar's thumb is dragged the ItemsLoading callback is called twice.
    When the PageDown key is hit or the scrollbar is clicked or the mouse wheel is actuated the ItemsLoading callback is called once as expected.
    I set the grid's IsBusy=true at the beginning of the ItemsLoading callback and IsBusy=false just before it returns.
    So when the thumb is dragged the grid is busy, then not busy and then busy again until the data appears.
    Also the thumb action isn't smooth.

    Thanks,
    Eric


  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 20 Dec 2010 Link to this post

    Hi,

    Generally  ItemsLoading will be raised multiple times if more than LoadSize data are needed. For example if you bind to a ListBox with 25 visible items on the screen and LoadSize is set to 10 you will get three calls for ItemsLoading.

    Greetings,
    Vlad
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Eric Lincoln
    Eric Lincoln avatar
    18 posts
    Member since:
    Jul 2009

    Posted 20 Dec 2010 Link to this post

    Hi Vlad,

    Vlad you're right if the load size is less than the number of items normally displayed in a view then the LoadingItems callback is called twice -even if one uses the keyboard or mouse to page down. However, in my case the load size was set to 5X times the number items required to populate the current view. Also I did an experiment where I set the load size to exactly the number of rows displayed in the grid and did a page down using either the keyboard or the mouse and the ItemsLoading callback was called only once. However, using the same load size, if I drag the scrollbar thumb the callback is called three times.
    Other considerations:
    1. The speed of the cursor doesn't have any affect on this behavior.
    2. The grid's DataLoadMode is the default.
     
    I mentioned the behavior of the IsBusy indicator in my first post but more importantly this incorrect response to the drag op impacts performance. 

    Thanks,
    Eric
  5. SPE
    SPE avatar
    34 posts
    Member since:
    Sep 2010

    Posted 31 May 2011 Link to this post

    setting the RadGridView's ScrollMode to 'Deferred' will prevent the ItemsLoading event being called twice.
    however, it will still be called twice for the topmost items when the RadGridView is initially loaded. but for the rest of the items it will not be called twice. hope this helps.
  6. Tim
    Tim avatar
    20 posts
    Member since:
    Jan 2009

    Posted 03 Jul 2015 Link to this post

    For the benefit of anyone who come across this thread.  I have been running into the issue of the ItemsLoading Event being called twice for the topmost items.  Originally my code would call to the server twice via a web service to get the items requested.  The SQL that I was running on the server was placing a high load on it and making two requests at the same time doubled the run time of the SQL (e.g. 12 seconds instead of 6 seconds).

    To fix this the ItemsLoading Event is received twice.  One call is made to the server and when complete, VirtualDataSource.Load is called twice.  If VirtualDataSource.Load is not called twice sometimes the scroll bar would not represent the true size of the available items.

    The detection of the double load is done by one list tracking what is being loaded.  When the ItemsLoading Event fires the second time, A check is done to see if the request is on the first tracking list​.  If it is on that list, the request is added to another tracking list indicating that it is a double load and the server is not called.  In the call back from the server, VirtualDataSource.Load is called once and t request removed from the first tracking list.  Then a check is done to see if the request is on the second tracking list indicating a double load.  If present there VirtualDataSource.Load is called again.

    Tim


  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 06 Jul 2015 Link to this post

    Hi Tim,

    Thank you for sharing your valuable input to the community.

    Regards,
    Dimitrina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner