|
// Grid’s toolbarClick event handler
toolbarClick(args: ClickEventArgs): void {
if(args.item.text === "PDF Export") {
// Retrieves selected record JSON data
var selectedRecords = this.grid.getSelectedRecords();
if (selectedRecords.length !== 0) {
// The selected record data is set to the export’s dataSource property and passed along with the pdfExport method
let exportProperties = {
dataSource: selectedRecords,
};
this.grid.pdfExport(exportProperties);
} else {
// If no records are selected, then the entire data is exported
this.grid.pdfExport();
}
} else if (args.item.text === "Excel Export") {
// The same approach can be used for excel export
}
} |