Hi,
I was wondering how to create a new grid dynamically in code when a button is pressed?
Thanks,
Charles
|
[app.component.ts]
bindGridJSFn(e) {
var grid = new Grid({
allowPaging: true,
dataSource: data,
columns: [
{ field: 'OrderID', headerText: 'Order ID', width: 100 },
{ field: 'Freight', headerText: 'Freight', width: 100 },
{ field: 'CustomerID', headerText: 'Customer Name', width: 100 },
],
});
grid.appendTo('#myGrid');
}
} |
Hello,
I can confirm this does let me create a new grid, but when trying to export the new grid to excel nothing seems to happen. Below is a screenshot of the code I am using.
Thanks,
Charles
|
[app.component.ts]
Grid.Inject(ExcelExport);
bindGridJSFn(e) {
var grid = new Grid({
allowPaging: true,
dataSource: data,
allowExcelExport: true,
dataBound: function () {
grid.excelExport();
},
columns: [
{ field: 'OrderID', headerText: 'Order ID', width: 100 },
{ field: 'Freight', headerText: 'Freight', width: 100 },
{ field: 'CustomerID', headerText: 'Customer Name', width: 100 },
],
});
grid.appendTo('#myGrid');
} |