- Home
- Forum
- Angular - EJ 2
- get grid instance from toolbarClick
get grid instance from toolbarClick
Hi,
I've 3 grids in component.
How can I get the grid instance in toolbarClick.
I need some similar at this
toolbarClick(args: ClickEventArgs): void {
const grid: GridComponent;
grid = args.item.controlParent;
switch (args.item.text) {
case 'PDF Export':
grid.pdfExport();
break;
case 'Excel Export':
gridResumen.excelExport();
break;
case 'CSV Export':
grid.csvExport();
break;
}
}
But grid variable, is not GridComponent
SIGN IN To post a reply.
5 Replies
TS
Thavasianand Sankaranarayanan
Syncfusion Team
November 29, 2018 04:54 AM UTC
Hi Manolo,
Thanks for contacting Syncfusion support.
You can get the grid instances from the ‘this.grid’ parameter in the toolbarClick event of Grid.
Refer the help documentation.
Regards,
Thavasianand S.
MC
Manolo Capdevila
November 29, 2018 11:08 AM UTC
Hi,
With this.grid I need save the grid reference in grid vairable.
My question is if, since ClickEventArgs, I can get the grid reference for export.
I've three different grids, so if in toolbarClick function, I can get the grid instance, I don't need save each grid reference in different variables
Thanks
MS
Madhu Sudhanan P
Syncfusion Team
November 30, 2018 06:22 AM UTC
Hi Manolo,
Thanks for contacting Syncfusion support.
You can use the same event handler for multiple grid by passing the template variable as the argument of the event as follows.
|
<ejs-grid #grid (toolbarClick)='toolbarClick($event, grid)' [allowExcelExport]='true' [allowPdfExport]='true' >
...
</ejs-grid>
<ejs-grid #grid5 (toolbarClick)='toolbarClick($event, grid5)'
[allowExcelExport]='true' [allowPdfExport]='true'>
...
</ejs-grid>
export class ExportingComponent implements OnInit {
...
toolbarClick(args: ClickEventArgs, grid: GridComponent): void {
switch (args.item.text) {
case 'PDF Export':
grid.pdfExport();
break;
...
}
}
}
|
Regards,
Madhu Sudhanan P
MC
Manolo Capdevila
November 30, 2018 01:28 PM UTC
Thanks!
TS
Thavasianand Sankaranarayanan
Syncfusion Team
December 3, 2018 05:26 AM UTC
Hi Manolo,
We are happy that the problem has been solved.
Please get back to us if you need any further assistance.
Regards,
Thavasianand S.
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
MC Manolo Capdevila
- Nov 28, 2018 12:06 PM UTC
- Dec 3, 2018 05:26 AM UTC