Issue with Dropevent

Dear Support,

Trying to get use of drag and drop with datagrid and bind drop even on that, however it seem that there is someting wrong.. Issue is with RowDragEventArgs  as im geeting error "Argument 2: cannot convert from 'method group' to 'EventCallback'".

<div class="col-lg-6 control-section">
    <div class="content-wrapper">
        <div class="row">
            <SfGrid id="Grid" DataSource="@UserData" AllowRowDragAndDrop="true" AllowSelection="true" AllowPaging="true">
                <GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Multiple"></GridSelectionSettings>
                <GridPageSettings PageCount="1" PageSize="12"></GridPageSettings>
                <GridRowDropSettings TargetID="DestGrid"></GridRowDropSettings>
                <GridColumns>
                    <GridColumn Field=@nameof(ApplicationUser.id) HeaderText="ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn>
                    <GridColumn Field=@nameof(ApplicationUser.username) HeaderText="Name" Width="135"></GridColumn>
                    <GridColumn Field=@nameof(ApplicationUser.email) HeaderText="Email" Format="d" TextAlign="TextAlign.Right" Width="130"></GridColumn>
                </GridColumns>
            </SfGrid>
        </div>
    </div>
</div>
<div class="col-lg-1 control-section">
    <div class="content-wrapper">
        <div class="row">
        </div>
    </div>
</div>
<div class="col-lg-5 control-section">
    <div class="content-wrapper">
        <div class="row">
            <SfGrid id="DestGrid" DataSource="@PermissionGrid" AllowRowDragAndDrop="true" TValue="UserPermissionModel" AllowSelection="true" AllowPaging="true">
                <GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Single"  ></GridSelectionSettings>
                <GridPageSettings PageCount="1" PageSize="12"></GridPageSettings>
                <GridEvents OnActionFailure="OnFailer" RowDrag="@OnDatGridDrop" ></GridEvents>
                <GridRowDropSettings TargetID="Grid"></GridRowDropSettings>
                <GridColumns>
                    <GridColumn Field=@nameof(UserPermissionModel.id) HeaderText="ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn>
                    <GridColumn Field=@nameof(UserPermissionModel.user_id) HeaderText="User ID" Width="135"></GridColumn>
                    <GridColumn Field=@nameof(UserPermissionModel.plugin_id) HeaderText="PluginID" Format="d" TextAlign="TextAlign.Right" Width="130"></GridColumn>
                </GridColumns>
            </SfGrid>
        </div>
    </div>
</div>

<div>
    <h3 style="color:darkgray">DEBUG:</h3>
    <label class="text-danger">Messgage: @error</label>
</div>
@code { 

    string error;
    public List<ApplicationUser> UserData { get; set; }
    public List<UserPermissionModel> PermissionGrid { get; set; }

    public async Task OnDatGridDrop(RowDragEventArgs<UserPermissionModel> e)
    {
        error = e.FromIndex.ToString();
    }

    public async Task OnFailer(Syncfusion.Blazor.Grids.FailureEventArgs args)
    {
        error = args.Error.ToString();
    }

}




1 Reply 1 reply marked as answer

PS Pavithra Subramaniyam Syncfusion Team June 25, 2020 11:33 AM UTC

Hi Michal, 
 
Thanks for contacting Syncfusion support. 
 
We have validated the provided code and found that you have missed to bind the TValue inside the GridEvents which is the cause of the issue. In DataGrid component, When using events, TValue must be provided in the GridEvents component. Please refer to the below code example and documentation link for more information. 
 
<div class="col-lg-5 control-section"> 
            <SfGrid id="DestGrid" DataSource="@PermissionGrid" AllowRowDragAndDrop="true" TValue="UserPermissionModel" AllowSelection="true" AllowPaging="true"> 
                <GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Single"></GridSelectionSettings> 
                <GridPageSettings PageCount="1" PageSize="12"></GridPageSettings> 
                <GridEvents OnActionFailure="OnFailer" RowDrag="@OnDatGridDrop" TValue="UserPermissionModel"></GridEvents> 
                <GridRowDropSettings TargetID="Grid"></GridRowDropSettings> 
                <GridColumns> 
                    .   .  . 
                </GridColumns> 
            </SfGrid> 
</div> 
@code { 
    public List<UserPermissionModel> PermissionGrid { get; set; } 
 
    public async Task OnDatGridDrop(RowDragEventArgs<UserPermissionModel> e) 
    { 
      .  .  . 
    } 
 
} 
 

Please get back to us if you need any further assistance on this. 

Regards, 
Pavithra S 


Marked as answer
Loader.
Up arrow icon