AllowRowDragAndDrop failed when dropping at the same index

Hello i am using the drag and drop to move rows in a grid
It works fine until i select a row and replace it exactly at the same place.
WHen I do this, i have the following error

Uncaught Error: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')

Even if i comment my methods, remove the drop, select, deselect method I got the error.
I have no idea where it comes from

Here is a sample code 

    <SfGrid ID="segmentGrid" DataSource="@GridDataSegment" Toolbar="@(new List<string>() { "Search" })" AllowSelection="true" AllowRowDragAndDrop="true" AllowSorting="true" @ref="@gridSegment">
        <GridPageSettings PageSize="5"></GridPageSettings>
        <GridEvents RowSelected="RowSelectHandlerSegment" RowDeselected="RowDeselectHandlerSegment" RowDropped="RowSegmentDrop" TValue="Segment"></GridEvents>
        <GridSortSettings>
            <GridSortColumns>
                <GridSortColumn Field="SegmentPriority" Direction="SortDirection.Ascending"></GridSortColumn>
            </GridSortColumns>
        </GridSortSettings>

        <GridColumns>
            <GridColumn Field=@nameof(Segment.SegmentId) HeaderText="Segment ID" TextAlign="TextAlign.Right" Width="120" IsPrimaryKey="true"></GridColumn>
            <GridColumn Field=@nameof(Segment.SegmentPriority) HeaderText="Priority" TextAlign="TextAlign.Right" Width="120"></GridColumn>
            <GridColumn Field=@nameof(Segment.SegmentCode) HeaderText="Segment Code" Width="150"></GridColumn>
            <GridColumn Field=@nameof(Segment.SegmentDescription) HeaderText="Description" TextAlign="TextAlign.Right" Width="200"></GridColumn>
            <GridColumn Field=@nameof(Segment.SegmentSQL) HeaderText="SQL Request" TextAlign="TextAlign.Right" Width="250"></GridColumn>
        </GridColumns>
    </SfGrid>

2 Replies 1 reply marked as answer

ME Mehdi June 17, 2021 02:29 PM UTC

It seems to be fixed with 19.1

Marked as answer

VN Vignesh Natarajan Syncfusion Team June 18, 2021 03:26 AM UTC

Hi Mehdi,  

Thanks for contacting Syncfusion support.  

We are glad to hear that you have resolved the reported query on your own by upgrading to our latest version.  

Please get back to us with more details if you have further queries.  

Regards, 
Vignesh Natarajan  



Loader.
Up arrow icon