Event when the entire grid is populated

9 posts, 0 answers
  1. Todd Millett
    Todd Millett avatar
    115 posts
    Member since:
    Jul 2009

    Posted 21 Feb 2011 Link to this post

    I wanted to know the event that gets executed after the entire Grid is populated/Loaded with data.
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 21 Feb 2011 Link to this post

    Hi Todd Millett,

    You may try to use the DataLoaded event. Let me know if it meets your requirements.
     

    All the best,
    Maya
    the Telerik team
  3. Todd Millett
    Todd Millett avatar
    115 posts
    Member since:
    Jul 2009

    Posted 21 Feb 2011 Link to this post

    I tried attaching the DataPopulated event, but it is not firing exactly after the data is populated, it is firing randomly 2,3,4 times when i am attaching the itemsource property. I have hooked the handler before setting the itemsource, Please find the code snippet

    myGrid.DataLoaded -= new EventHandler<EventArgs>(myGrid_DataLoaded);
                myGrid.ItemsSource = null;
                myGrid.DataLoaded += new EventHandler<EventArgs>(myGrid_DataLoaded);
                
                myGrid.ItemsSource = archives.GetItemDetails();

    Please Let me know, if I am missing anything.
  4. robert hutchison
    robert hutchison avatar
    18 posts
    Member since:
    Feb 2010

    Posted 01 Apr 2011 Link to this post

    Hi,

    I've been working with the same issue, but for me, both the DataLoaded (on the GridView) and the LoadedData (on the DomainDataSource) both get executed before the RowLoaded events for the GridView.  Perhaps they should be named something else, like "SomeDataHasBeenLoaded"...  :-)

    I've spent about a week and a half experimenting with combinations of all of the other events and haven't been able to find anything that would reliably execute after the last row was loaded into the grid, so I redid my logic to handle what I needed to do in the RowLoaded event handler (a little of it is a bit redundant, but I used static (VB heap) variables to avoid repeating too much) and it ended up being not too bad (I only have a few hundred rows in these tables).

    I think I understand why Telerik has this problem - they are inheriting it from Microsoft who doesn't generate an "all done" event when the last of the data is loaded (I believe this is the case and I don't want to speak for them - please correct me if I am wrong).

    Thanks,
    Rob
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 05 Apr 2011 Link to this post

    Hello robert hutchison,

    Generally, the DataLoaded events ensures that the data items are loaded. However, that does not guarantee that the UI is created as well. RowLoaded event is fired on loading the rows, consequently if you are scrolling for example it will be fired as well for the new rows. Furthermore, if you implement a pager, the DataLoaded will be fired after the items for the current page are available.
     

    All the best,
    Maya
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  6. robert hutchison
    robert hutchison avatar
    18 posts
    Member since:
    Feb 2010

    Posted 07 Apr 2011 Link to this post

    Hi,

    It guarantees that some data items have been loaded.  There is nothing that tells us that all of the data items have been loaded - this would be very useful, especially with smaller datasets that aren't paged. It is very useful to know when the data is "ready to use".

    For example, I need to load 30 rows with 6 elements in each row into a small GridView and then (only then) tell the user to do something (or do something else in the program internally). I need to make sure this works correctly on fast machines and on slow machines and telling the user before the rows finish loading is not acceptable behavior.

    Another example is: being able to tell the user how many records there are in the recordset.

    How can you do this if there is no "final" event? (without rewriting RIA services, that is)

    Do you attach a data pager with a huge page size with visibility=collapsed in hopes that you will get a DataLoaded event at the right time? I didn't try this, but my guess would be that it will not receive the event while it is not visible.

    Rob
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 08 Apr 2011 Link to this post

    Hi robert hutchison,

    As the UI is loaded asynchronously, the Framework does not provide any event that will ensure all the elements are available. RadGridView, as a standard Silverlight control, does follow this concept as well. 
    You might try the LayoutUpdated event, but still it may not guarantee all items are loaded.

     
    Kind regards,
    Maya
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  8. robert hutchison
    robert hutchison avatar
    18 posts
    Member since:
    Feb 2010

    Posted 11 Apr 2011 Link to this post

    Hi,

    I think you're missing the point entirely. I know that the control doesn't supply such an event.  What I was trying to say is that there is a essential business need for such an event that cannot be satisfied any other way (short of writing our own GridView control).

    The controls should meet the business needs, especially when the need is so fundamental. What I hear in your response is "it is what it is - take it or leave it - have the users deal with it."

    "Asynchronous" is not the issue - it is how "asynchronous" was implemented. If an operation is "asynchronous", it should have a "final" event that tells the caller when the operation has finished. Otherwise, the caller just hangs out forever, not knowing when to proceed with the next task it needs to accomplish (it would normally do this in the "final" event handler). Typically, if there is an event that has a name in the "past tense", (such as "data loaded"), it would make sense to have that designated as the "final" event.

    We want to be able to write correctly working applications with your controls, but can't. This behavior is broken. Yes, the behavior of the control you base it on is broken as well, but you could fix it (at a minimum you could add some sort of "all finished loading" event - that would preserve backwards compatibility with the broken behavior of the control you base yours on).

    What I was hoping for by posting my earlier comment was not to receive a "take or leave it" comment back, but rather an indication that someone recognized the need for a "final" event, so that perhaps in a future release, we might see one. It would make applications that use your RadGridView work a whole lot better.

    Thanks
  9. JJ Loubser
    JJ Loubser avatar
    42 posts
    Member since:
    Jul 2009

    Posted 14 Feb 2012 Link to this post

    yes their must be an event that is running the entire time then in that event you can check if the item is loaded what you want to scroll to or use in the grid then do the scroll then kill the event, something like that must exist???
Back to Top