observables for Grid data binding then it exports current page records only. If you want to export only the visited page or some specific records, define the dataSource in exportProperties as follows, |
public toolbarClick(args): any {
if (args.item.id === 'Grid_pdfexport') { // 'Grid_pdfexport' -> Grid component id + _ + toolbar item name
args.cancel = true; // prevent default exporting
let state1 = { skip: 0, take: (this.grid.pageSettings.currentPage * this.grid.pageSettings.pageSize) }; // calulate viewed page records count
this.service.getData(state1).subscribe((e) => {
// get the viewed page records from the service
let pdfExportProperties: any = {
dataSource: (e as any).result // assign result to data source property
};
this.grid.pdfExport(pdfExportProperties); // export specific page records
});
}
}
|