-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
61 lines (60 loc) · 1.64 KB
/
index.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$(function () {
const storageKey = 'datagrid-state';
$('#gridContainer').dxDataGrid({
dataSource: orders,
keyExpr: 'ID',
columns: [{
dataField: 'OrderNumber',
width: 130,
caption: 'Invoice Number',
}, {
dataField: 'OrderDate',
dataType: 'date',
sortOrder: 'desc',
}, {
dataField: 'SaleAmount',
alignment: 'right',
format: 'currency',
},
'Employee', {
caption: 'City',
dataField: 'CustomerStoreCity',
}, {
caption: 'State',
dataField: 'CustomerStoreState',
groupIndex: 0,
}],
allowColumnReordering: true,
allowColumnResizing: true,
showBorders: true,
selection: {
mode: 'single',
},
filterRow: {
visible: true,
},
groupPanel: {
visible: true,
},
pager: {
showPageSizeSelector: true,
allowedPageSizes: [5, 10, 20],
},
stateStoring: {
enabled: true,
type: 'custom',
storageKey: storageKey,
customLoad() {
return JSON.parse(localStorage.getItem(storageKey));
},
customSave(state) {
if (state) {
for (let i = 0; i < state.columns.length; i++) {
state.columns[i].filterValue = null;
}
}
localStorage.setItem(storageKey, JSON.stringify(state));
}
}
});
});