|
this.selectionOptions = { allowColumnSelection: true, type: 'Multiple' };
toolbarClick(args: any): void {
if (args.item.id === 'Grid_pdfexport') {
this.refreshCol = (this.grid as any).columns;
if (this.grid.getSelectedColumnsUid().length > 0) {
var col = [];
for (var i = 0; i < this.grid.getSelectedColumnsUid().length; i++) {
col.push(this.grid.getColumnByUid(this.grid.getSelectedColumnsUid()[i]))
}
(this.grid as any).columns = col;
}
this.grid.pdfExport();
}
}
pdfExportComplete(args) {
(this.grid as any).columns = this.refreshCol;
} |
|
toolbarClick(args: any): void {
if (args.item.id === 'Grid_pdfexport') {
this.refreshCol = (this.grid as any).columns; // initially store the grid columns in variable
if (this.grid.getSelectedColumnsUid().length > 0) {
var col = []; // create empty array
//Push your specific columns to the empty array
for (var i = 0; i < this.grid.getSelectedColumnsUid().length; i++) {
col.push(this.grid.getColumnByUid(this.grid.getSelectedColumnsUid()[i]))
}
// Assign pushed columns to the grid columns.
(this.grid as any).columns = col;
}
this.grid.pdfExport();
}
}
|
|
export class AppComponent {
public data: Object[] = [];
@ViewChild('grid', { static: true })
public grid: GridComponent;
----------------------------------------------
toolbarClick(args: any): void {
if (args.item.id === 'Grid_pdfexport') {
this.refreshCol = (this.grid as any).columns;
if ((this.grid as any).getSelectedColumnsUid().length > 0) {
var col = [];
for (var i = 0; i < (this.grid as any).getSelectedColumnsUid().length; i++) {
col.push(this.grid.getColumnByUid((this.grid as any).getSelectedColumnsUid()[i]))
}
(this.grid as any).columns = col;
}
this.grid.pdfExport();
}
} |