This is a migrated thread and some comments may be shown as answers.

RowLoaded event only raised on every other row

5 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 27 Mar 2012, 08:21 PM
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

5 Answers, 1 is accepted

Sort by
0
Tyree
Top achievements
Rank 2
answered on 28 Mar 2012, 04:33 PM
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.
0
Nedyalko Nikolov
Telerik team
answered on 29 Mar 2012, 09:18 AM
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 >>
0
Joshua
Top achievements
Rank 1
answered on 03 May 2013, 09:49 PM
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.
0
Nick
Telerik team
answered on 08 May 2013, 11:12 AM
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.

0
Pankaj
Top achievements
Rank 1
answered on 10 Jun 2013, 11:56 AM
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 
Tags
GridView
Asked by
Joseph
Top achievements
Rank 1
Answers by
Tyree
Top achievements
Rank 2
Nedyalko Nikolov
Telerik team
Joshua
Top achievements
Rank 1
Nick
Telerik team
Pankaj
Top achievements
Rank 1
Share this question
or