Toolbar with custom functionality

Hi Team,
I use syncfusion grid any grid have powerful features. A want extend my toolbar.
First I wrote my custom form which validate all data before saving into database.
I want add button like "Add" but with my functionality like inexample
Example:

Also when I use custom toolbar buttons, for example add, also I need options to update record on first row.
if (item.text === "Add") {
// DO SOMETHING
}
Can I achieve this?

1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team September 24, 2018 10:12 AM UTC

Hi Marko, 

Thanks for contacting Syncfusion support. 

Query 1 : Validate the all values before save the value in database 
We suggest you to use the “actionBegin” event of Grid. In that event handler, we can get the user added/inserted record details.  
 
 
Please refer the code example below, 
[html] 
 
<ejs-grid [dataSource]='data' [editSettings]='editSettings' ... (actionBegin)="begin($event)"> 
     ... 
</ejs-grid> 
 
 
[ts] 
 
    begin(args:any){ 
      if(args.requestType == "save"){ 
        //In "args.data" you will be getting the values of the edited row. Now you can perform validation here. 
      } 
    } 
 

Query 2 : perform the add operation while click the custom toolbar button. 
We suggest you to use the “addRecord” method of Grid to add a record to Grid, when the custom toolbar icon is clicked.  
 
We also suggest you to refer the below methods of Grid, to perform CRUD operations. 
 
Please get back to us if you need further assistance. 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon