-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeforeRender.js
More file actions
30 lines (29 loc) · 892 Bytes
/
beforeRender.js
File metadata and controls
30 lines (29 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function onBeforeRender(sender) {
var dashboardControl = sender.GetDashboardControl();
dashboardControl.option({
extensions: {
dataInspector: {
onGridInitialized
}
}
});
}
function onGridInitialized(e) {
e.component.option({
export: {
enabled: true
},
onExporting() {
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Main sheet');
DevExpress.excelExporter.exportDataGrid({
component: e.component,
worksheet: worksheet
}).then(function () {
workbook.xlsx.writeBuffer().then(function (buffer) {
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), 'DataGrid.xlsx');
});
});
}
});
}