EditMode.Dialog in the grid, add operations only

Hello,
I am quite pleased with the editing the grid items in place, however for the add I need to provide a more advanced form for selection.
I would like then to use the EditMode.Dialog but only for Add operations.
Is this possible?

Thanks a lot

1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team February 15, 2021 08:41 AM UTC

Hi A B, 

Greetings from Syncfusion support. 

We suggest you to use as like the below codes to achieve this requirement. Based on the bool value from OnActionBegin handler use either Normal or Dialog modes. We have also prepared a sample for your convenience, please download the sample from the link below, 

Please refer the codes below, 

 
<SfGrid @ref="Grid" ...> 
    <GridEvents OnActionBegin="OnActionBegin" OnActionComplete="OnActionComplete" TValue="Order"></GridEvents> 
    @if (EditModeSelection) 
    { 
       <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog"></GridEditSettings> 
    } 
    else 
    { 
       <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Normal"></GridEditSettings> 
    } 
    ... 
</SfGrid> 
 
    public bool EditModeSelection { getset; } 
 
    public void OnActionBegin(ActionEventArgs<Order> args) 
    { 
        if (args.RequestType.ToString() == "BeginEdit") 
        { 
            EditModeSelection = false; 
        } 
        else if (args.RequestType.ToString() == "Add") 
        { 
            EditModeSelection = true; 
        } 
    } 
    public void OnActionComplete(ActionEventArgs<Order> args) 
    { 
        if (args.RequestType.ToString() == "Add" || args.RequestType.ToString() == "BeginEdit") 
        { 
            args.PreventRender = false; 
        } 
    } 


Reference :  

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon