RowLoaded event only raised on every other row

6 posts, 0 answers
  1. Joseph
    Joseph avatar
    1 posts
    Member since:
    Nov 2011

    Posted 27 Mar 2012 Link to this post

    I'm using RadGridView to display a changing data set with Data Virtualization and UI Row Virtualization. I have a RowStyleSelector that sets various visual properties for the rows depending on the data. Selection Mode is Extended. When new data arrives from the server, I call VirtualQueryableCollectionView.Load to load the updated items into the grid.

    This all seems to work. However, I'm having problems getting selection to work properly when I update the data. My objects have a unique ID and I keep track of the selected IDs in the ViewModel. When new data is loaded into the grid, I am trying to handle the RowLoaded event and check if the ID of the data is in my SelectedIDs list; if so, I set row.IsSelected=True, otherwise False.

    The problem I am seeing is that I only get a RowLoaded event for every other row! So when new data arrives, my selection is only preserved on every other row and the others become deselected visually. I tried removing my RowStyleSelector but it still happens, so it's not related to that.

    Is this a bug or am I doing something wrong? I was having this problem in 2011Q3 and just upgraded to 2012Q1 and still have the same issue.

    Thanks,
    Joseph
  2. Tyree
    Tyree avatar
    105 posts
    Member since:
    Dec 2006

    Posted 28 Mar 2012 Link to this post

    I have not experienced the RowLoaded on every other row but depending on the circustances I know you will have problems using RowLoaded because your rows are virtualized. From my experience instead of responding to RowLoaded (which may not, and should not always fire) you do a pub/sub or event on your VM that your V receives the "selected" ids, items, whatnot and it in turn it can manipulate radgridview.SelectedItems collection as appropriate.
  3. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 29 Mar 2012 Link to this post

    Hello,

    You can take a look at this blog post for some ideas how to synchronize selected items. 

    All the best,
    Nedyalko Nikolov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  4. Joshua
    Joshua avatar
    5 posts
    Member since:
    May 2013

    Posted 03 May 2013 Link to this post

    Did you figure out a solution to this problem?
    Im using WPF but have a similar problem.
    Im using VirtualQueryableCollectionView with the GridView. I am using the RowLoaded event and set the Row.IsSelected property to true when a row should be selected.

    I don't want to bind to SelectedItems since the items are generated each time a Load is called on the virtual collection, and the old items are not kept in memory.

    The reason for maintaining a separate list of IDs and setting Row.IsSelected is the GridView only knows about what is currently visible and can only select what is visible. Since our data source is virtualized we cannot bind to selected items.
    Selection can't be maintained this way for items not visible in the grid. But we can catch when a row is loaded and select it then, so this way we can maintain selection state for the whole grid, even for items not visible.
  5. Nick
    Admin
    Nick avatar
    593 posts

    Posted 08 May 2013 Link to this post

    Hi Joshua,

    Have you tried this with our latest binaries? Do you get the same behavior?

    Regards,
    Nik
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Pankaj
    Pankaj avatar
    2 posts
    Member since:
    Dec 2008

    Posted 10 Jun 2013 Link to this post

    Hi,
        I am facing this same issue and also I am using 2013.1.220.1050 version of telerik dll. 
    To elaborate I am using VirtualQueryableCollectionView for paging.The grid contains a checkbox column in cell zero and I have attached RadGrid_RowLoaded  event in xaml.When I scroll gridview  RadGrid_RowLoaded  event fires for alternate rows and unable to get any event which fires on all the rows when scrolled.
    Please let me know how can I solve my problem.This seems to be very critical

    Thanks & Regards
    Pankaj 
Back to Top