Drag and drop

Thank you in advance,

I am using the drag and drop information from the Essential Studio, https://blazor.syncfusion.com/documentation/datagrid/events/, and using v.18.2.0.54, The code below is launching the drag/drop visual indication, but not reordering the grid order. 

    <SfGrid DataSource="@_rm_records" AllowRowDragAndDrop="true" Height="300">
        <GridSelectionSettings Type="SelectionType.Multiple"></GridSelectionSettings>
        <GridEvents RowDropped="RowDropHandler" TValue="RegexModel" Created="CreatedHandler" />
        <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" />
        <GridColumns>
            <GridColumn Field=@nameof(RegexModel.RegexCollectionID) HeaderText="Index" Visible="false" TextAlign="TextAlign.Left" Width="120"></GridColumn>
            <GridColumn Field=@nameof(RegexModel.Display) HeaderText="Name" TextAlign="TextAlign.Left" Width="120"></GridColumn>
            <GridColumn Field=@nameof(RegexModel.Pattern) HeaderText="Pattern" TextAlign="TextAlign.Left" Width="300"></GridColumn>
        </GridColumns>
    </SfGrid>

@code {

     private List<RegexModel> _rm_records { get; set; }

    public void RowDropHandler(RowDragEventArgs<RegexModel> args)
    {
        var test = "Hello";
    }

    public void RowDragStartHandler(RowDragEventArgs<RegexModel> args)
    {
        var test = "Hello";
    }

    public void CreatedHandler(object args)
    {
        // Here you can customize your code
    }
}

1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team August 31, 2020 10:06 AM UTC

Hi Scott, 

Greetings from Syncfusion support. 

We suggest you to ensure to set IsPrimaryKey for a unique value column in Grid to overcome the problem you are facing. Please refer the code below, 

<GridColumns> 
    <GridColumn Field=@nameof(RegexModel.RegexCollectionID) HeaderText="Index" IsPrimaryKey="true" Visible="false" TextAlign="TextAlign.Left" Width="120"></GridColumn> 
    ... 
</GridColumns> 


Please refer the online demo from the link below, 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon