Extended Selection with RadGridView and Virtualization

11 posts, 0 answers
  1. Rupert Henson
    Rupert Henson avatar
    8 posts
    Member since:
    Jul 2009

    Posted 28 Jul 2011 Link to this post

    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

     

  2. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 01 Aug 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Rupert Henson
    Rupert Henson avatar
    8 posts
    Member since:
    Jul 2009

    Posted 09 Aug 2011 Link to this post

    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.
  5. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 10 Aug 2011 Link to this post

    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 >>

  6. Gene
    Gene avatar
    11 posts
    Member since:
    Jul 2011

    Posted 13 Sep 2011 Link to this post

    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)?
  7. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 16 Sep 2011 Link to this post

    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 >>

  8. Gene
    Gene avatar
    11 posts
    Member since:
    Jul 2011

    Posted 16 Sep 2011 Link to this post

    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
  9. Gene
    Gene avatar
    11 posts
    Member since:
    Jul 2011

    Posted 16 Sep 2011 Link to this post

    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.

  10. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 21 Sep 2011 Link to this post

    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 >>

  11. Gene
    Gene avatar
    11 posts
    Member since:
    Jul 2011

    Posted 21 Sep 2011 Link to this post

    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.
  12. Gene
    Gene avatar
    11 posts
    Member since:
    Jul 2011

    Posted 25 Jan 2012 Link to this post

    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
    ---------------
Back to Top
DevCraft banner