How to customize the Grid edit dialog

Hi Team,

I want to add a new object by using the Grid edit dialog, as there is some field formatting and parsing need to be pre-processed before submit. How can I get the access to the "Save" button and handle the data format beforehand? And can I hit a customize api endpoint instead of the default DataManager Adaptor?

Regards,

Feifan

1 Reply

VN Vignesh Natarajan Syncfusion Team February 20, 2020 07:05 AM UTC

Hi Feifan,  

Greetings from Syncfusion support.  

Query: “How can I get the access to the "Save" button and handle the data format beforehand? And can I hit a customize api endpoint instead of the default DataManager Adaptor?” 

We suggest you to achieve your requirement using OnActionBegin event of EjsGrid when RequestType is Save. OnActionBegin event will be triggered when an certain action is initiated. So while saving the record. OnActionBegin event will be triggered with a RequestType as Save.  

Refer the below code example.  

<EjsGrid @ref="@SiteGrid" TValue="Site" AllowPaging="true" AllowSorting="true" AllowFiltering="true" AllowGrouping="true" 
         Toolbar="@(new List<string>() { "Add""Edit""Update""Delete""Search"})"> 
    <GridEvents OnActionBegin="Begin" TValue="Site"></GridEvents> 
. . . . . . .. . . . . . ..  
</EjsGrid> 
. . . . . . . . . 
public void Begin(ActionEventArgs<SiteArgs)   {       if(Args.RequestType == Syncfusion.EJ2.Blazor.Grids.Action.Save)       {           Args.Cancel = true// prevents the default actions.           var data = Args.Data; // gives the inserted / edited records.           // from here call your server to make changes in your database            // refresh the Grid       }   }
  
Refer our UG documentation for your reference 



if above solution does not resolve your query, kindly get back to us with more details about your requirement. 

Regards, 
Vignesh Natarajan. 
 


Loader.
Up arrow icon