Hi,
Pre the 2009Q2 release, I could select and scroll to an item by setting the IsSelected and IsCurrent of that item to true and use BringDataItemIntoView. That worked perfectly all the time (except when grouped, but that's another forum post ;)).
In the current release, this doesn't work correct all the time. If I have a RadGridView that can 'show' 17 rows for instance, and I try to select an item with that's outside the viewport, it won't get selected/made current (using SetIsCurrent and SetIsSelected), but BringDataItemIntoView will still scroll to the item.
Is that a bug or am I doing something wrong?
Pre the 2009Q2 release, I could select and scroll to an item by setting the IsSelected and IsCurrent of that item to true and use BringDataItemIntoView. That worked perfectly all the time (except when grouped, but that's another forum post ;)).
In the current release, this doesn't work correct all the time. If I have a RadGridView that can 'show' 17 rows for instance, and I try to select an item with that's outside the viewport, it won't get selected/made current (using SetIsCurrent and SetIsSelected), but BringDataItemIntoView will still scroll to the item.
Is that a bug or am I doing something wrong?
7 Answers, 1 is accepted
0
Hi RVW,
As of Q2 the usage of the IsSelected and IsCurrent properties is not encouraged. Alternatively you can select a record or a data item by using RadGridView.SelectedRecord or RadGridView.SelectedItem properties. You could also select an item by adding it to the RadGridView.SelectedItems collection.
You could try modifying your code like that:
Kind regards,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
As of Q2 the usage of the IsSelected and IsCurrent properties is not encouraged. Alternatively you can select a record or a data item by using RadGridView.SelectedRecord or RadGridView.SelectedItem properties. You could also select an item by adding it to the RadGridView.SelectedItems collection.
You could try modifying your code like that:
this.GridView.SelectedRecord = this.GridView.Records[3]; |
this.GridView.BrindDataItemIntoView(this.GridView.SelectedItem); |
Kind regards,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
JDB
Top achievements
Rank 1
answered on 15 Jul 2009, 06:39 AM
Hi Milan,
The GridView.SelectedRecord is marked as obsolete, so I don't want to use that (my resharper is already going crazy due all obsolete warnings in the latest release). Using SelectedItem works though.
Which makes me wonder why you added the SetIsCurrent and SetIsSelected methods to the grid if they don't work properly?
This solution also fixes the IndexOutOfRange exception thrown by BringDataItemIntoView if an item is in a collapsed group, but now a first chance exception occurs (ArgumentOutOfRangeException).
The GridView.SelectedRecord is marked as obsolete, so I don't want to use that (my resharper is already going crazy due all obsolete warnings in the latest release). Using SelectedItem works though.
Which makes me wonder why you added the SetIsCurrent and SetIsSelected methods to the grid if they don't work properly?
This solution also fixes the IndexOutOfRange exception thrown by BringDataItemIntoView if an item is in a collapsed group, but now a first chance exception occurs (ArgumentOutOfRangeException).
0
Hello RVW,
SetIsCurrent and SetIsSelected should have been marked with a warning "This property is used by the Selector infrastructure and is not meant to be used directly from your code." but I guess we haven't done that. Sorry for confusing you.
Could you share more info about the exception? Is there a stack trace that could help us resolve the problem?
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
SetIsCurrent and SetIsSelected should have been marked with a warning "This property is used by the Selector infrastructure and is not meant to be used directly from your code." but I guess we haven't done that. Sorry for confusing you.
Could you share more info about the exception? Is there a stack trace that could help us resolve the problem?
Sincerely yours,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
JDB
Top achievements
Rank 1
answered on 15 Jul 2009, 01:45 PM
Hi Milan,
this is the stacktrace:
Mind you, this only occurs if a BringDataItemIntoView is called for an item that is in a collapsed group.
this is the stacktrace:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. |
Parameter name: index |
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) |
at System.ThrowHelper.ThrowArgumentOutOfRangeException() |
at System.Collections.Generic.List`1.get_Item(Int32 index) |
at System.Collections.ObjectModel.Collection`1.get_Item(Int32 index) |
at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.BringRecordIntoView(Record record) in c:\Builds\WPF_Scrum\GridView_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.cs:line 846 |
at Telerik.Windows.Controls.GridView.GridViewItemsControl.BringDataItemIntoView(Object data) in c:\Builds\WPF_Scrum\GridView_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewItemsControl.cs:line 977 |
at Telerik.Windows.Controls.GridView.GridViewDataControl.BringDataItemIntoView(Object dataItem) in c:\Builds\WPF_Scrum\GridView_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 2682 |
Mind you, this only occurs if a BringDataItemIntoView is called for an item that is in a collapsed group.
0
Accepted
Hello RVW,
Currently the best way to overcome this problem is to have expanded groups. We are already working on a solution and we will try to include a fix in next week's Latest Internal Build.
Thanks for reporting this issue. Your Telerik points have been updated.
Greetings,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Currently the best way to overcome this problem is to have expanded groups. We are already working on a solution and we will try to include a fix in next week's Latest Internal Build.
Thanks for reporting this issue. Your Telerik points have been updated.
Greetings,
Milan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Saranya Parameswaran
Top achievements
Rank 1
answered on 15 Sep 2009, 07:29 AM
Hi,
If i use up/down key to select the record in the grid the scroll bar does not automatically move to the record in focus(or selected). Do i have to enable something for this to work?
Regards,
Saranya
If i use up/down key to select the record in the grid the scroll bar does not automatically move to the record in focus(or selected). Do i have to enable something for this to work?
Regards,
Saranya
0
Hello Saranya,
I've just tried our online demo however everything worked fine.
Greetings,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I've just tried our online demo however everything worked fine.
Greetings,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.