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

Extended Selection with RadGridView and Virtualization

10 Answers 214 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rupert Henson
Top achievements
Rank 1
Rupert Henson asked on 28 Jul 2011, 04:08 PM
Hi,

I've followed the example and created a RadGridView (2011.2.712.1040) using the standard technique for using Data Virtualization in the ItemsLoading method to call a RIA Services entity query and it works well, including Sorting and Custom Filters etc.

When you scroll the GridView down with the Scrollbar or mousewheel, the "yet to be loaded" items appear nice and quickly when demanded so all is well.....

However, I've just noticed that if I start an Extended Selection with the mouse and drag to the bottom to force it to scroll onwards to continue, it scrolls for a while then crashes out with an exception (presumably when it hits a non-loaded item in the virtual collection) ?

I was going to confirm this issue in the online DV demo, but unfortunately it's only a single selection mode in the demo. Could you check if this is reproducable/fixable? I think it's a clash between multi selection and the virtual collection.

Regards,

Rupert.

Message: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: 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.System.Collections.IList.get_Item(Int32 index)
   at Telerik.Windows.Data.VirtualQueryableCollectionView.GetItemAt(Int32 index)
   at Telerik.Windows.Data.DataItemCollection.get_Item(Int32 index)
   at Telerik.Windows.Data.Selection.ItemSelectionHandler.MultiSelect(Object actionItem)
   at Telerik.Windows.Data.Selection.ItemSelectionHandler.SelectRange(Object actionItem, Boolean cleanCurrentSelection)
   at Telerik.Windows.Data.Selection.ItemSelectionHandler.PerformExtendedSelection(Object item, SelectionModificationOptions options)
   at Telerik.Windows.Data.Selection.ItemSelectionHandler.PerformSelection(Object item, SelectionModificationOptions options)
   at Telerik.Windows.Controls.GridView.Selection.CompositeSelectionHandler.PerformRowSelection(Object dataItem, SelectionModificationOptions modificationOptions)
   at Telerik.Windows.Controls.GridView.Selection.CellAndRowSelectionDispatcher.HandleSelectionForValidRowInput(SelectionModificationOptions allowedModifications, GridViewRow row)
   at Telerik.Windows.Controls.GridView.Selection.CellAndRowSelectionDispatcher.HandleSelectionForRowInput(GridViewRow row, SelectionModificationOptions allowedModifications)
   at Telerik.Windows.Controls.GridView.Selection.SelectionDrag.TrySelectRowUnderMouse(Boolean scrollAdjusted)
   at Telerik.Windows.Controls.GridView.Selection.SelectionDrag.TrySelectElementUnderMouse(Boolean scrollAdjusted)
   at Telerik.Windows.Controls.GridView.Selection.SelectionDrag.ProcessMouseMove(Point newMousePosition, Boolean scrollAdjusted)
   at Telerik.Windows.Controls.GridView.Selection.SelectionDrag.ScrollCoordinator_ScrollViewerAdjusted(Object sender, ScrollViewerAdjustedEventArgs e)
   at Telerik.Windows.Controls.GridView.Scrolling.ScrollViewerCoordinator.OnScrollViewerAdjusted(Point adjustments)
   at Telerik.Windows.Controls.GridView.Scrolling.ScrollViewerCoordinator.OnScrollViewerScrollChanged(Object sender, EventArgs e)
   at Telerik.Windows.Controls.GridView.Scrolling.GridViewScrollViewerAdapter.OnScrollChanged(EventArgs args)
   at Telerik.Windows.Controls.GridView.Scrolling.GridViewScrollViewerAdapter.<.ctor>b__0(Object s, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at Telerik.Windows.Controls.GridView.GridViewScrollViewer.OnScrollChanged(ScrollChangedEventArgs e)
   at Telerik.Windows.Controls.GridView.GridViewScrollViewer.OnLayoutUpdated(Object sender, EventArgs e)
   at System.Windows.FrameworkElement.OnLayoutUpdated(Object sender, EventArgs e)
   at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)    

Line: 56
Char: 13
Code: 0
URI: http://localhost:4920/CarzTestPage.aspx

 

10 Answers, 1 is accepted

Sort by
0
Yordanka
Telerik team
answered on 01 Aug 2011, 12:41 PM
Hello Rupert Henson,

Thank you for the report.
We reproduced the exception and it was fixed immediately. The fix will be part of the internal build later today.

I have updated your Telerik points.
 
All the best,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Rupert Henson
Top achievements
Rank 1
answered on 09 Aug 2011, 11:54 AM
Thanks Yordanka, I will download that and give it a try.

Just one further slight issue I'm finding now, is that using the ItemsLoading technique does not seem to be correctly re-loading once filters are applied which have zero rows returned.

For Example,

1) Form loads with no filters applied and virtual data loads fine.
2) Apply a filter to a column which reduces the rows down to none (eg. Values = "8" on a column that has values 1-5). No rows shown, which is correct.
3) Clear the filter..... Does not appear to restart the Items Loading.

Do I need to trap a Filter change event that restarts the whole query load process if the current result is no rows?

Regards,

Rupert.
0
Yordanka
Telerik team
answered on 10 Aug 2011, 05:11 PM
Hi Rupert Henson,

Please check the DataVitualization demo on how to implement filtering when RadGridView is bound to the virtual collection. The full source code of the demo can be found from ExampleCS_SL.sln supplied with the Telerik controls installation.

Let me know if you have any further questions.
 
Best wishes,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Gene
Top achievements
Rank 1
answered on 13 Sep 2011, 02:27 PM
Since it appears related and does not appear to have been addressed in the interim build, another problem while using extended selection is that in addition to dragging the selection acrossed page boundaries (based on LoadSize) when you make a selection anchor and then scroll down and close the selection (using deferred scrolling) a cellinfo error occurs because the items in between have not yet been loaded.

Is this something that can be addressed simarlarly to the issue while dragging the selection (which does appear fixed in the interim build)?
0
Yordanka
Telerik team
answered on 16 Sep 2011, 03:35 PM
Hello Gene,

I have tried to reproduce the reported problem but I couldn't. Could you please try reproducing it using the attached test application? Or if there is something missed to modify the application in a way that shows the exception?
 
Greetings,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Gene
Top achievements
Rank 1
answered on 16 Sep 2011, 03:53 PM
The example you posted is not using data virtualization to a remote source, it is using datavirtualization to a local observable collection. This means that all of the data is synchonously available when the selection is made.

In order to reproduce the issue the itemsource should be set to a VirtualQueryableCollectionView which is loading its data dynamically from a remote source, the radgridview should also be set to deferred scrolling (although depedning on the speed of the scroll this is not absolutely necessary to reproduce the gridinfo error).

In the case where a selection anchor is started and a scroll to susequent load area farther down in the grid is performed and then the selection is closed a gridinfo error is thrown because the intermediate data has not been loaded. When looking at the VirtualQueryableCollectionView (VQCV) results you will see something similar to the following if the selection is started in the first loadsize=0-4 (with loadsize=5) scrollarea and then scrolled to the last loadsize=10-14 scroll area. The items 5-9 are still null and are included in the selection appear to be the issue because they are never loaded from the remote RIA source. The grid then throws a gridinfo error.

VQCV[0] = object
VQCV[1] = object
VQCV[2] = object
VQCV[3] = object
VQCV[4] = object
VQCV[5] = null
VQCV[6] = null
VQCV[7] = null
VQCV[8] = null
VQCV[9] = null
VQCV[10] = object
VQCV[11] = object
VQCV[12] = object
VQCV[13] = object
VQCV[14] = object
0
Gene
Top achievements
Rank 1
answered on 16 Sep 2011, 05:14 PM
I've created a sample solution using RIA services with a VirtualQueryableCollectionView which exhibits the selection error described.


Where can I upload this zip file? The current forum only allows upload of image files.

In the sample solution you will need to attach the sql 2008R2 database located in the app_data directory to a sql server and modify the connection string in the web.config if the target sql servicer differs form .\sqlexpress using integrated security.

0
Yordanka
Telerik team
answered on 21 Sep 2011, 04:10 PM
Hello Gene,

Thank you for the details.
I was able to reproduce the problem and logged it as a bug. We will do our best to provide a fix for it in one of the next internal builds. You can track its progress following PITS ID7934.

Excuse us for the inconvenience caused. I have updated your Telerik points.
 
Kind regards,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Gene
Top achievements
Rank 1
answered on 21 Sep 2011, 06:42 PM
Actually the issue wasn't limited to drag selection with RIA and Deferred scrolling, it was also related to extended selection (using shift-click to end the selection on subsequent items).

Alll in all I would say that selection in RadGridView with VirtualQueryableCollectionView as a source using RIA services is completely broken unless you are only including items in the selection directly in the viewing area.

As previously stated it does not appear that there is a mechanism for RadGridView to tell the VirtualQueryableCollectionView to load the intermediate items in the selection array that haven't been viewed in the grid (causing them to load) which causes an error.
0
Gene
Top achievements
Rank 1
answered on 25 Jan 2012, 04:50 PM
With the Silverlight release 2011.3 it appears that the intermediary data is being loaded but the selection is not updated once the items finish loading.

It appears that the unloaded rows that are part of the selection are loading in the background but once loaded they are still not a part of the selecteditems collection in the grid itself. This is using deferred scrolling, synch or async data loading in the grid

If I manully reassert the extended selection (shift click) on the last selected row visible in the grid after the intermediary data is loaded it does then select all the intermediary rows. Unfortunately I cannot emulate that action in code. Since the SelectedItems never contains all of the actual selection (it only ever contains those items that were visible on the first page of viewed data where the selection began and the items that were part of the selection on the last page viewed where the selection ended). In the example below the selecteditem count is 6 instead of 11 after the data finishes loading and selecteditems only contains the first and last page of selected data. Additionally in the UI it is only showing the selected data from the first and last page.

This is frustrating because it is very close to working but I am unable to grab onto the correct data or an event to complete the extended selection!

---------- begin selection first page
nonselected item
nonselected item
nonselected item
begin selection
selected item
selected item
selected item
---------

--------intermediary data in non viewed scoll pages not selected but intended to be selected using extended selection
nonselected item
nonselected item
nonselected item
nonselected item
nonselected item

--------------- end selection last viewed page
selected item
selected item
selected item
end selection
nonselected item
nonselected item
nonselected item
nonselected item
---------------
Tags
Data Virtualization
Asked by
Rupert Henson
Top achievements
Rank 1
Answers by
Yordanka
Telerik team
Rupert Henson
Top achievements
Rank 1
Gene
Top achievements
Rank 1
Share this question
or