Hi PDev,
Greetings from Syncfusion support.
Based on your requirement, you want to get the instance of the current child grid when you click on the custom button in the toolbar of your child grid. Also, you want to get the id of the current child grid when you click on the custom button in the toolbar.
Please refer the below code example, which demonstrates an example of how to get the instance and id of the current child grid when you click on the toolbar's custom button.
this.childGrid = {
queryString: 'EmployeeID',
pageSettings: { pageSize: 6, pageCount: 5 },
toolbar: ['CustomButton'],
toolbarClick: function (args) {
if (args.item.text === 'CustomButton') {
var currentChildGrid = args.originalEvent.target
.getElementsByClassName('e-grid')[0].ej2_instances[0];
console.log(currentChildGrid.element.id);
{ field: 'ShipCity', headerText: 'Ship City', width: 120 },
{ field: 'Freight', headerText: 'Freight', width: 120 },
{ field: 'ShipName', headerText: 'Ship Name', width: 150 },
}; |
Please find the attached sample and get back to us for further details.
Regards,
Joseph I.