Drag and Drop between Grids problem with CustomDataAdaptor

I have two Grids using CustomDataAdaptors as their source. 

I need to be able to drag a row from one grid to the other and Add the dropped row to the second grid with some field manipulation of the dropped data. (Say including in dropped dateTime or Sequence Number etc)

However in my testing (as attached), if I use a CustomDataAdaptor, the RowDropped event doesn't fire and the dropped row appears to get "stuck" on the target grid. 

Is there a known issue with Dragging Between Grids using a CustomDataAdaptor? Or some other process I am unaware of?

Please see my attached sample project for my issue. 

Note: For this test I am using a simple list of objects however I will connect each Grid to a database (outside the scope of this example) so a simple Bound Datasource will not fulfill this requirement. Although it is interesting to note that if I swap the CustomDataAdaptor to a Bound List of Items using @bind-DataSource the events fire as expected.

Thanks in advance for your help.

Cheers,

Shannon

Attachment: BlazorTest_e5b74082.zip

1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team July 30, 2020 12:57 PM UTC

Hi Shannon, 

Greetings from Syncfusion support. 

We suggest you to ensure to set true for the AllowRowDragAndDrop property for the Target Grid(Grid2) also to overcome the problem(as mentioned in screenshot) you are facing. Please use the code below, 

 
<SfGrid ID="Grid2" TValue="Grid2Item" AllowPaging="true" AllowRowDragAndDrop="true"> 
    ... 
</SfGrid>  

 

And also from your shared sample we could see that you are binding data from CustomAdaptor to Grid. When binding custom adaptor to Grid we need to handle the insert(into target Grid2) and delete(from Grid1) actions in the BatchUpdate/BatchUpdateAsync method of the corresponding CustomAdaptor classes(Grid1CustomDataAdaptor, Grid2CustomDataAdaptor). This method will be triggered when row drag and drop between grids. Please refer the below documentation for details regarding the method handling. 

    public class Grid1CustomDataAdaptor : DataAdaptor    {       ...       public override object BatchUpdate(DataManager dm, object Changed, object Added, object Deleted, string KeyField, string Key, int? dropIndex)       {          ...          if (Deleted != null)          {            //Delete the dragged row data from Grid1           }          return Data;       }    }    public class Grid2CustomDataAdaptor : DataAdaptor    {        ...        public override object BatchUpdate(DataManager dm, object Changed, object Added, object Deleted, string KeyField, string Key, int? dropIndex)        {            ...            if (Added != null)            {                //Add the dragged row data from Grid1 to Grid2 here             }            ...            return Data;        }    }
 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon