Drag and Drop between different datasource grid
Hi there , doing a test to drag and drop between different tables grid i saw that the event RowDropped Is never activated or called . Is it possible to do this thing ? THX
<SfGrid DataSource="@AddressesDataSource" ID="AddressGrid" AllowRowDragAndDrop="true" AllowSelection="true">
<GridRowDropSettings TargetID="CustomerGrid"></GridRowDropSettings>
<GridEvents
RowDragStarting="RowDragStartingHandler"
RowDropping="RowDroppingHandler"
RowDropped="RowDroppedHandler"
TValue="Address">
</GridEvents>
</SfGrid>
<br />
<br />
<br />
<SfGrid DataSource="@CustomersDataSource" ID="CustomerGrid" AllowRowDragAndDrop="true" AllowSelection="true">
<GridRowDropSettings TargetID="AddressGrid"></GridRowDropSettings>
<GridEvents
RowDragStarting="RowDragStartingHandler2"
RowDropping="RowDroppingHandler2"
RowDropped="RowDroppedHandler2"
TValue="Customer">
</GridEvents>
</SfGrid>
Hi
Francesco,
We checked your query and code, and it seems that the Grid column is generated
as an autogenerated column. We would like to inform you that for performing the
row drag-and-drop action on the DataGrid, one of the columns should be defined
as the primary key using the IsPrimaryKey property. In the current code, the
primary key is not enabled, so the drag-and-drop action does not occur, and the
RowDrop event is not called or triggered. Please refer to the code snippet and
sample for more information.
Reference : https://blazor.syncfusion.com/documentation/datagrid/row-drag-and-drop#drag-and-drop-events
Sample : https://blazorplayground.syncfusion.com/embed/hjVejCjrIfxDyGdr?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5
|
<GridRowDropSettings TargetID="CustomerGrid"></GridRowDropSettings> <GridColumns> <GridColumn Field="OrderID" HeaderText="Order ID" Width="120" IsPrimaryKey="true" TextAlign="TextAlign.Center" /> |
Regards,
Naveen
thank you sorry now the RowDroppedHandler function is activated thank you. completely forgot to put IsPrimaryKey=‘true’ once the record is dragged to another table I will open a dialog to insert a couple of fields.
should be fine now
thanks again
Thanks for the update, We are happy to hear that the provided information was helpful. We are closing the thread now.
Please get back to us if you have further queries.
- 3 Replies
- 2 Participants
-
FP Francesco Pruneri
- Dec 31, 2024 01:25 PM UTC
- Jan 7, 2025 05:03 AM UTC