jsl-ui 9.18.2 → 9.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/grid.css +0 -8
- package/lib/index.css.map +1 -1
- package/lib/index.js +10198 -61
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/components/IntervalComponent.d.ts +0 -17
- package/lib/components/IntervalComponent.js +0 -68
- package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +0 -22
- package/lib/components/auto-suggest/AutoSuggestComponent.js +0 -49
- package/lib/components/button/ButtonComponent.d.ts +0 -18
- package/lib/components/button/ButtonComponent.js +0 -46
- package/lib/components/checkbox/CheckBoxComponent.d.ts +0 -28
- package/lib/components/checkbox/CheckBoxComponent.js +0 -94
- package/lib/components/checkbox/CheckBoxStyle.scss +0 -86
- package/lib/components/date/DateComponent.d.ts +0 -32
- package/lib/components/date/DateComponent.js +0 -106
- package/lib/components/date-range/DateRangeComponent.d.ts +0 -35
- package/lib/components/date-range/DateRangeComponent.js +0 -136
- package/lib/components/date-range/DateRangeStyle.scss +0 -12
- package/lib/components/date-time/DateTimeComponent.d.ts +0 -15
- package/lib/components/date-time/DateTimeComponent.js +0 -53
- package/lib/components/date-time/DateTimeStyle.scss +0 -7
- package/lib/components/dialog/DialogComponent.d.ts +0 -67
- package/lib/components/dialog/DialogComponent.js +0 -242
- package/lib/components/drop-down/DropDownComponent.d.ts +0 -27
- package/lib/components/drop-down/DropDownComponent.js +0 -74
- package/lib/components/expander/ExpanderComponent.d.ts +0 -27
- package/lib/components/expander/ExpanderComponent.js +0 -90
- package/lib/components/expander/ExpanderStyle.scss +0 -47
- package/lib/components/expander/OldExpanderStyle.scss +0 -37
- package/lib/components/form-field/FormComponent.d.ts +0 -12
- package/lib/components/form-field/FormComponent.js +0 -26
- package/lib/components/form-field/FormFieldComponent.d.ts +0 -38
- package/lib/components/form-field/FormFieldComponent.js +0 -139
- package/lib/components/form-field/FormFieldStyle.scss +0 -87
- package/lib/components/grid/GridComponent.d.ts +0 -26
- package/lib/components/grid/GridComponent.js +0 -116
- package/lib/components/input/InputComponent.d.ts +0 -33
- package/lib/components/input/InputComponent.js +0 -144
- package/lib/components/loading/LoadingComponent.d.ts +0 -8
- package/lib/components/loading/LoadingComponent.js +0 -22
- package/lib/components/loading/LoadingStyle.css +0 -29
- package/lib/components/navigation/NavigationComponent.d.ts +0 -34
- package/lib/components/navigation/NavigationComponent.js +0 -70
- package/lib/components/navigation/NavigationStyle.scss +0 -226
- package/lib/components/notification/Notification.d.ts +0 -17
- package/lib/components/notification/Notification.js +0 -56
- package/lib/components/notification/Notification.scss +0 -19
- package/lib/components/number/NumberComponent.d.ts +0 -25
- package/lib/components/number/NumberComponent.js +0 -87
- package/lib/components/overlay/OverlayComponent.d.ts +0 -27
- package/lib/components/overlay/OverlayComponent.js +0 -149
- package/lib/components/overlay/overlay.css +0 -57
- package/lib/components/progress/ProgressComponent.d.ts +0 -18
- package/lib/components/progress/ProgressComponent.js +0 -42
- package/lib/components/progress/ProgressStyle.scss +0 -15
- package/lib/components/ribbon-menu/RibbonMenuComponent.d.ts +0 -12
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +0 -34
- package/lib/components/ribbon-menu/RibbonMenuStyle.scss +0 -76
- package/lib/components/select/SelectComponent.d.ts +0 -79
- package/lib/components/select/SelectComponent.js +0 -362
- package/lib/components/select/SelectDDAreaComponent.d.ts +0 -32
- package/lib/components/select/SelectDDAreaComponent.js +0 -317
- package/lib/components/select/SelectStyle.scss +0 -187
- package/lib/components/slider/nouislider.css +0 -310
- package/lib/components/slider/nouislider.d.ts +0 -44
- package/lib/components/slider/nouislider.js +0 -2158
- package/lib/components/stack-panel/SplitterComponent.d.ts +0 -21
- package/lib/components/stack-panel/SplitterComponent.js +0 -126
- package/lib/components/stack-panel/SplitterStyle.scss +0 -45
- package/lib/components/stack-panel/StackPanelComponent.d.ts +0 -20
- package/lib/components/stack-panel/StackPanelComponent.js +0 -64
- package/lib/components/stack-panel/StackPanelStyle.scss +0 -53
- package/lib/components/tabs/TabsComponent.d.ts +0 -39
- package/lib/components/tabs/TabsComponent.js +0 -177
- package/lib/components/tabs/TabsStyle.scss +0 -76
- package/lib/components/time/TimeComponent.d.ts +0 -29
- package/lib/components/time/TimeComponent.js +0 -113
- package/lib/components/time/TimeComponent.scss +0 -4
- package/lib/components/tree-view/TreeViewComponent.d.ts +0 -23
- package/lib/components/tree-view/TreeViewComponent.js +0 -45
- package/lib/components/tree-view/TreeViewStyle.scss +0 -96
- package/lib/components/virtual-render/VirtualRenderComponent.d.ts +0 -30
- package/lib/components/virtual-render/VirtualRenderComponent.js +0 -104
- package/lib/components/virtual-render/VirtualRenderStyle.scss +0 -9
- package/lib/core/culture.d.ts +0 -5
- package/lib/core/culture.js +0 -385
- package/lib/core/date.d.ts +0 -14
- package/lib/core/date.js +0 -350
- package/lib/core/helper.d.ts +0 -12
- package/lib/core/helper.js +0 -101
- package/lib/core/jq.d.ts +0 -37
- package/lib/core/jq.js +0 -371
- package/lib/core/lang.d.ts +0 -24
- package/lib/core/lang.js +0 -28
- package/lib/core/numeric.d.ts +0 -7
- package/lib/core/numeric.js +0 -143
- package/lib/core/polyfills.d.ts +0 -0
- package/lib/core/polyfills.js +0 -22
- package/lib/core.d.ts +0 -6
- package/lib/core.js +0 -6
- package/lib/grid/controls/slick.columnpicker.css +0 -46
- package/lib/grid/controls/slick.draggablegrouping.css +0 -52
- package/lib/grid/controls/slick.gridmenu.css +0 -127
- package/lib/grid/controls/slick.pager.css +0 -41
- package/lib/grid/examples/examples.css +0 -203
- package/lib/grid/filterDialogs/dateRangeFilter.d.ts +0 -7
- package/lib/grid/filterDialogs/dateRangeFilter.js +0 -156
- package/lib/grid/filterDialogs/excelFilter.d.ts +0 -9
- package/lib/grid/filterDialogs/excelFilter.js +0 -313
- package/lib/grid/plugins/ext.overlay.css +0 -28
- package/lib/grid/plugins/ext.overlay.d.ts +0 -2
- package/lib/grid/plugins/ext.overlay.js +0 -291
- package/lib/grid/plugins/slick.cellrangedecorator.d.ts +0 -12
- package/lib/grid/plugins/slick.cellrangedecorator.js +0 -68
- package/lib/grid/plugins/slick.cellrangeselector.d.ts +0 -1
- package/lib/grid/plugins/slick.cellrangeselector.js +0 -144
- package/lib/grid/plugins/slick.cellselectionmodel.d.ts +0 -1
- package/lib/grid/plugins/slick.cellselectionmodel.js +0 -194
- package/lib/grid/plugins/slick.headerbuttons.css +0 -40
- package/lib/grid/plugins/slick.headerbuttons.d.ts +0 -55
- package/lib/grid/plugins/slick.headerbuttons.js +0 -156
- package/lib/grid/plugins/slick.headermenu.css +0 -101
- package/lib/grid/plugins/slick.headermenu.d.ts +0 -74
- package/lib/grid/plugins/slick.headermenu.js +0 -260
- package/lib/grid/plugins/slick.rowdetailview.css +0 -37
- package/lib/grid/plugins/slick.rowmovemanager.css +0 -8
- package/lib/grid/plugins/slick.rowmovemanager.d.ts +0 -18
- package/lib/grid/plugins/slick.rowmovemanager.js +0 -249
- package/lib/grid/plugins/slick.rowselectionmodel.d.ts +0 -1
- package/lib/grid/plugins/slick.rowselectionmodel.js +0 -167
- package/lib/grid/slick-default-theme.css +0 -154
- package/lib/grid/slick.core.d.ts +0 -90
- package/lib/grid/slick.core.js +0 -574
- package/lib/grid/slick.creator.d.ts +0 -80
- package/lib/grid/slick.creator.js +0 -723
- package/lib/grid/slick.dataview.d.ts +0 -71
- package/lib/grid/slick.dataview.js +0 -1080
- package/lib/grid/slick.editors.core.d.ts +0 -4
- package/lib/grid/slick.editors.core.js +0 -232
- package/lib/grid/slick.editors.date.d.ts +0 -2
- package/lib/grid/slick.editors.date.js +0 -125
- package/lib/grid/slick.editors.lookup.d.ts +0 -14
- package/lib/grid/slick.editors.lookup.js +0 -353
- package/lib/grid/slick.editors.nav.d.ts +0 -6
- package/lib/grid/slick.editors.nav.js +0 -22
- package/lib/grid/slick.formatters.d.ts +0 -17
- package/lib/grid/slick.formatters.js +0 -137
- package/lib/grid/slick.grid.css +0 -325
- package/lib/grid/slick.grid.d.ts +0 -284
- package/lib/grid/slick.grid.js +0 -5395
- package/lib/grid/slick.groupitemmetadataprovider.d.ts +0 -39
- package/lib/grid/slick.groupitemmetadataprovider.js +0 -165
- package/lib/grid/slick.tree.css +0 -20
- package/lib/grid/slick.tree.d.ts +0 -33
- package/lib/grid/slick.tree.js +0 -220
- package/lib/grid.d.ts +0 -13
- package/lib/grid.js +0 -13
- package/lib/index.css +0 -2584
- package/lib/index.d.ts +0 -56
- package/lib/interaction/dataconverter.d.ts +0 -4
- package/lib/interaction/dataconverter.js +0 -1
- package/lib/interaction/eventhandler.d.ts +0 -13
- package/lib/interaction/eventhandler.js +0 -42
- package/lib/interaction/moveable.css +0 -0
- package/lib/interaction/moveable.d.ts +0 -39
- package/lib/interaction/moveable.js +0 -172
- package/lib/interaction/resizable.css +0 -33
- package/lib/interaction/resizable.d.ts +0 -37
- package/lib/interaction/resizable.js +0 -123
- package/lib/ui/auto.suggest.css +0 -14
- package/lib/ui/auto.suggest.d.ts +0 -17
- package/lib/ui/auto.suggest.js +0 -255
- package/lib/ui/base.css +0 -150
- package/lib/ui/date.picker/css/date-range-picker.css +0 -87
- package/lib/ui/date.picker/css/tiny-date-picker.css +0 -326
- package/lib/ui/date.picker/date-picker-options.d.ts +0 -11
- package/lib/ui/date.picker/date-picker-options.js +0 -76
- package/lib/ui/date.picker/lib/date-manip.d.ts +0 -74
- package/lib/ui/date.picker/lib/date-manip.js +0 -120
- package/lib/ui/date.picker/lib/dom.d.ts +0 -23
- package/lib/ui/date.picker/lib/dom.js +0 -28
- package/lib/ui/date.picker/lib/emitter.d.ts +0 -13
- package/lib/ui/date.picker/lib/emitter.js +0 -49
- package/lib/ui/date.picker/lib/fns.d.ts +0 -23
- package/lib/ui/date.picker/lib/fns.js +0 -43
- package/lib/ui/date.picker/mode/base-mode.d.ts +0 -26
- package/lib/ui/date.picker/mode/base-mode.js +0 -248
- package/lib/ui/date.picker/mode/dropdown-mode.d.ts +0 -28
- package/lib/ui/date.picker/mode/dropdown-mode.js +0 -50
- package/lib/ui/date.picker/mode/index.d.ts +0 -28
- package/lib/ui/date.picker/mode/index.js +0 -18
- package/lib/ui/date.picker/mode/modal-mode.d.ts +0 -25
- package/lib/ui/date.picker/mode/modal-mode.js +0 -17
- package/lib/ui/date.picker/mode/permanent-mode.d.ts +0 -29
- package/lib/ui/date.picker/mode/permanent-mode.js +0 -19
- package/lib/ui/date.picker/views/day-picker.d.ts +0 -40
- package/lib/ui/date.picker/views/day-picker.js +0 -155
- package/lib/ui/date.picker/views/month-picker.d.ts +0 -26
- package/lib/ui/date.picker/views/month-picker.js +0 -65
- package/lib/ui/date.picker/views/year-picker.d.ts +0 -20
- package/lib/ui/date.picker/views/year-picker.js +0 -66
- package/lib/ui/date.picker.d.ts +0 -66
- package/lib/ui/date.picker.js +0 -32
- package/lib/ui/dialog.css +0 -109
- package/lib/ui/dialog.d.ts +0 -22
- package/lib/ui/dialog.js +0 -113
- package/lib/ui/drop.down.css +0 -472
- package/lib/ui/drop.down.d.ts +0 -52
- package/lib/ui/drop.down.js +0 -2112
- package/lib/ui/number.input.css +0 -3
- package/lib/ui/number.input.d.ts +0 -12
- package/lib/ui/number.input.js +0 -64
- package/lib/ui/tabs.css +0 -53
|
@@ -1,723 +0,0 @@
|
|
|
1
|
-
import { Slick } from "./slick.core";
|
|
2
|
-
import { SlickGrid } from "./slick.grid";
|
|
3
|
-
import { RowSelectionModel } from "./plugins/slick.rowselectionmodel";
|
|
4
|
-
import { DataView } from "./slick.dataview";
|
|
5
|
-
import { GroupItemMetadataProvider } from "./slick.groupitemmetadataprovider";
|
|
6
|
-
import { jQueryReplacement } from "../core/jq";
|
|
7
|
-
import { HeaderMenu } from "./plugins/slick.headermenu";
|
|
8
|
-
import { HeaderButtons } from "./plugins/slick.headerbuttons";
|
|
9
|
-
import { TextFormatter } from "./slick.formatters";
|
|
10
|
-
import { ExcelFilter } from "./filterDialogs/excelFilter";
|
|
11
|
-
import { UILang } from "../core/lang";
|
|
12
|
-
import { RowMoveManager } from "./plugins/slick.rowmovemanager";
|
|
13
|
-
import { Overlays } from "./plugins/ext.overlay";
|
|
14
|
-
var $ = jQueryReplacement;
|
|
15
|
-
export function createJSLGrid(selector, data, columns, option) {
|
|
16
|
-
var formulaObjects = [];
|
|
17
|
-
var headerMenu;
|
|
18
|
-
var headerButtons;
|
|
19
|
-
var formulas = {};
|
|
20
|
-
var container;
|
|
21
|
-
var filters = [];
|
|
22
|
-
var customCommandHandler;
|
|
23
|
-
var grid;
|
|
24
|
-
var dataView;
|
|
25
|
-
var rowMoveManager;
|
|
26
|
-
//let options: ISlickCreatorOptions;
|
|
27
|
-
function createMe() {
|
|
28
|
-
sanitizeColumns(columns);
|
|
29
|
-
var options = $.shallowExtend({ explicitInitialization: true, mode: "client" }, option);
|
|
30
|
-
container = typeof (selector) === "string" ?
|
|
31
|
-
document.querySelector(selector) :
|
|
32
|
-
selector;
|
|
33
|
-
if (!container) {
|
|
34
|
-
throw new Error("error: selector for SlickCreator is invalid");
|
|
35
|
-
}
|
|
36
|
-
if (options.showColumnGroups) {
|
|
37
|
-
options.createPreHeaderPanel = true;
|
|
38
|
-
options.showPreHeaderPanel = true;
|
|
39
|
-
}
|
|
40
|
-
customCommandHandler = option.editCommandHandler;
|
|
41
|
-
options.editCommandHandler = function (a, b, c) { handleEditCommand(a, b, c); };
|
|
42
|
-
var groupItemMetadataProvider = options.groupItemMetadataProvider || GroupItemMetadataProvider(options.groupItemOptions);
|
|
43
|
-
if (options.dataView != null) {
|
|
44
|
-
dataView = options.dataView;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
dataView = new DataView({ inlineFilters: true, groupItemMetadataProvider: groupItemMetadataProvider });
|
|
48
|
-
dataView.setItems(data, options.primaryKey);
|
|
49
|
-
}
|
|
50
|
-
grid = new SlickGrid(container, dataView, columns, options);
|
|
51
|
-
grid.registerPlugin(groupItemMetadataProvider);
|
|
52
|
-
grid.setSelectionModel(new RowSelectionModel());
|
|
53
|
-
grid.onHeaderCellRendered.subscribe(function (e, args) {
|
|
54
|
-
if (columnHasFilter(args.column.id)) {
|
|
55
|
-
//this column is filtered
|
|
56
|
-
args.node.classList.add("slick-filtered-header");
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
addCustomEvents();
|
|
60
|
-
setupDefaultSort();
|
|
61
|
-
setupChangeEvents();
|
|
62
|
-
if (options.showHeaderMenu) {
|
|
63
|
-
setupHeaderMenu();
|
|
64
|
-
}
|
|
65
|
-
setupHeaderButtons();
|
|
66
|
-
if (options.allowRowMove) {
|
|
67
|
-
rowMoveManager = new RowMoveManager({
|
|
68
|
-
cancelEditOnDrag: true,
|
|
69
|
-
singleRowMove: true,
|
|
70
|
-
disableRowSelection: true,
|
|
71
|
-
hideRowMoveShadow: false,
|
|
72
|
-
rowMoveShadowScale: 0.7,
|
|
73
|
-
rowMoveShadowOpacity: 0.9 // defaults to 0.95
|
|
74
|
-
});
|
|
75
|
-
grid.registerPlugin(rowMoveManager);
|
|
76
|
-
rowMoveManager.onBeforeMoveRows.subscribe(function (e, args) {
|
|
77
|
-
// debugger;
|
|
78
|
-
});
|
|
79
|
-
rowMoveManager.onMoveRows.subscribe(function (e, args) {
|
|
80
|
-
var extractedRows = [], left, right;
|
|
81
|
-
var rows = args.rows;
|
|
82
|
-
var insertBefore = args.insertBefore;
|
|
83
|
-
left = data.slice(0, insertBefore);
|
|
84
|
-
right = data.slice(insertBefore, data.length);
|
|
85
|
-
rows.sort(function (a, b) { return a - b; });
|
|
86
|
-
for (var i = 0; i < rows.length; i++) {
|
|
87
|
-
extractedRows.push(data[rows[i]]);
|
|
88
|
-
}
|
|
89
|
-
rows.reverse();
|
|
90
|
-
for (var i = 0; i < rows.length; i++) {
|
|
91
|
-
var row = rows[i];
|
|
92
|
-
if (row < insertBefore) {
|
|
93
|
-
left.splice(row, 1);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
right.splice(row - insertBefore, 1);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
data = left.concat(extractedRows.concat(right));
|
|
100
|
-
var selectedRows = [];
|
|
101
|
-
for (var i = 0; i < rows.length; i++)
|
|
102
|
-
selectedRows.push(left.length + i);
|
|
103
|
-
// grid.resetActiveCell();
|
|
104
|
-
dataView.beginUpdate();
|
|
105
|
-
dataView.setItems(data);
|
|
106
|
-
dataView.endUpdate();
|
|
107
|
-
grid.render();
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
if (option.enableFillDown) {
|
|
111
|
-
var overlayPlugin = new Overlays({});
|
|
112
|
-
// Event fires when a range is selected
|
|
113
|
-
overlayPlugin.onFillUpDown.subscribe(function (e, args) {
|
|
114
|
-
var column = grid.getColumns()[args.range.fromCell];
|
|
115
|
-
// Ensure the column is editable
|
|
116
|
-
if (column.editor == null || column.readonly || !grid.getOptions().editable) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
// Find the initial value
|
|
120
|
-
dataView.beginUpdate();
|
|
121
|
-
var value;
|
|
122
|
-
var items = [];
|
|
123
|
-
if (args.direction === "down") {
|
|
124
|
-
var item = dataView.getItem(args.range.fromRow);
|
|
125
|
-
value = grid.getDataItemValueForColumn(item, column); // item[column.field];
|
|
126
|
-
// Copy the value down
|
|
127
|
-
for (var i = args.range.fromRow + 1; i <= args.range.toRow; i++) {
|
|
128
|
-
if (grid.onBeforeEditCell.notify({ row: i, cell: args.range.fromCell, item: dataView.getItem(i), column: column }, e) !== false) {
|
|
129
|
-
var currentItem = dataView.getItem(i);
|
|
130
|
-
items.push(currentItem);
|
|
131
|
-
// if (options.setDataItemValueForColumn != null) {
|
|
132
|
-
// options.setDataItemValueForColumn(currentItem, column, value);
|
|
133
|
-
// } else {
|
|
134
|
-
// dataView.getItem(i)[column.field] = value;
|
|
135
|
-
// }
|
|
136
|
-
// grid.invalidateRow(i);
|
|
137
|
-
// grid.onAfterEdit.notify({ grid, oldValue, newValue: value, column, item: dataView.getItem(i) }, e);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
var item = dataView.getItem(args.range.toRow);
|
|
143
|
-
items.push(item);
|
|
144
|
-
value = grid.getDataItemValueForColumn(item, column); // item[column.field];
|
|
145
|
-
// Copy the value up
|
|
146
|
-
for (var i = args.range.fromRow; i <= args.range.toRow - 1; i++) {
|
|
147
|
-
if (grid.onBeforeEditCell.notify({ row: i, cell: args.range.fromCell, item: dataView.getItem(i), column: column }, e) !== false) {
|
|
148
|
-
var currentItem = dataView.getItem(i);
|
|
149
|
-
items.push(currentItem);
|
|
150
|
-
// if (options.setDataItemValueForColumn != null) {
|
|
151
|
-
// options.setDataItemValueForColumn(currentItem, column, value);
|
|
152
|
-
// } else {
|
|
153
|
-
// dataView.getItem(i)[column.field] = value;
|
|
154
|
-
// }
|
|
155
|
-
// grid.invalidateRow(i);
|
|
156
|
-
// grid.onAfterEdit.notify({ grid, oldValue, newValue: value, column, item: dataView.getItem(i) }, e);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
grid.onAfterFillDown.notify({ grid: grid, value: value, column: column, direction: args.direction, range: args.range, items: items }, e);
|
|
161
|
-
dataView.endUpdate();
|
|
162
|
-
grid.render();
|
|
163
|
-
});
|
|
164
|
-
grid.registerPlugin(overlayPlugin);
|
|
165
|
-
}
|
|
166
|
-
if (!option.explicitInitialization) {
|
|
167
|
-
grid.init();
|
|
168
|
-
}
|
|
169
|
-
if (options.showColumnGroups) {
|
|
170
|
-
setTimeout(function () {
|
|
171
|
-
// TODO -> find better solution then timeout
|
|
172
|
-
grid.onColumnsResized.subscribe(function () {
|
|
173
|
-
CreateColumnGroups();
|
|
174
|
-
});
|
|
175
|
-
CreateColumnGroups();
|
|
176
|
-
}, 1);
|
|
177
|
-
}
|
|
178
|
-
if (options.saveColumnsKey) {
|
|
179
|
-
grid.onColumnsResized.subscribe(function () {
|
|
180
|
-
storeColumnSettings();
|
|
181
|
-
});
|
|
182
|
-
grid.onColumnsReordered.subscribe(function () {
|
|
183
|
-
storeColumnSettings();
|
|
184
|
-
});
|
|
185
|
-
loadColumnSettings();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function CreateColumnGroups() {
|
|
189
|
-
var options = grid.getOptions();
|
|
190
|
-
var columns = grid.getColumns();
|
|
191
|
-
if (options.frozenColumn >= 0) {
|
|
192
|
-
// Add column groups to left panel
|
|
193
|
-
var $preHeaderPanel = $(grid.getPreHeaderPanel());
|
|
194
|
-
renderHeaderGroups($preHeaderPanel, 0, options.frozenColumn + 1);
|
|
195
|
-
// Add column groups to right panel
|
|
196
|
-
$preHeaderPanel = $(grid.getPreHeaderPanelRight());
|
|
197
|
-
renderHeaderGroups($preHeaderPanel, options.frozenColumn + 1, columns.length);
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
var $preHeaderPanel = $(grid.getPreHeaderPanel());
|
|
201
|
-
renderHeaderGroups($preHeaderPanel, 0, columns.length);
|
|
202
|
-
}
|
|
203
|
-
function renderHeaderGroups(preHeaderPanel, start, end) {
|
|
204
|
-
preHeaderPanel.empty()
|
|
205
|
-
.addClass("slick-header-columns")
|
|
206
|
-
.css("left", "-1000px")
|
|
207
|
-
.width(grid.getHeadersWidth());
|
|
208
|
-
preHeaderPanel[0].parentElement.classList.add("slick-header");
|
|
209
|
-
var headerColumnWidthDiff = grid.getHeaderColumnWidthDiff();
|
|
210
|
-
var header;
|
|
211
|
-
var lastColumnGroup = "";
|
|
212
|
-
var widthTotal = 0;
|
|
213
|
-
for (var i = start; i < end; i++) {
|
|
214
|
-
var m = columns[i];
|
|
215
|
-
if (lastColumnGroup === m.columnGroup && i > start) {
|
|
216
|
-
widthTotal += m.width;
|
|
217
|
-
header.width(widthTotal - headerColumnWidthDiff);
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
widthTotal = m.width;
|
|
221
|
-
header = $("<div class='ui-state-default slick-header-column' />")
|
|
222
|
-
.html("<span class='slick-column-name'>" + (m.columnGroup || '') + "</span>")
|
|
223
|
-
.width(m.width - headerColumnWidthDiff)
|
|
224
|
-
.appendTo(preHeaderPanel);
|
|
225
|
-
}
|
|
226
|
-
lastColumnGroup = m.columnGroup;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
function storeColumnSettings() {
|
|
231
|
-
var cols = grid.getColumns();
|
|
232
|
-
var options = grid.getOptions();
|
|
233
|
-
var colSettings = cols.map(function (c) { return ({ id: c.id, width: c.width }); });
|
|
234
|
-
if (window.localStorage) {
|
|
235
|
-
localStorage.setItem("_grid_col_settings_" + options.saveColumnsKey, JSON.stringify(colSettings));
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
function loadColumnSettings() {
|
|
239
|
-
if (!window.localStorage) {
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
var options = grid.getOptions();
|
|
243
|
-
var key = options.saveColumnsKey;
|
|
244
|
-
if (key) {
|
|
245
|
-
var cols = grid.getColumns();
|
|
246
|
-
var colSettings = JSON.parse(localStorage.getItem("_grid_col_settings_" + key));
|
|
247
|
-
if (!colSettings) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
for (var i = 0; i < colSettings.length; i++) {
|
|
251
|
-
for (var j = 0; j < cols.length; j++) {
|
|
252
|
-
if (cols[j].id === colSettings[i].id) {
|
|
253
|
-
var c = cols[j];
|
|
254
|
-
c.width = colSettings[i].width;
|
|
255
|
-
if (i !== j) {
|
|
256
|
-
cols.splice(j, 1);
|
|
257
|
-
cols.splice(i, 0, c);
|
|
258
|
-
}
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
grid.setColumns(cols);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function sanitizeColumns(cols) {
|
|
267
|
-
for (var i = 0; i < cols.length; i++) {
|
|
268
|
-
var c = cols[i];
|
|
269
|
-
if (c.field === undefined && c.id) {
|
|
270
|
-
c.field = c.id;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
function addCustomEvents() {
|
|
275
|
-
grid.onAfterEdit = new Slick.Event();
|
|
276
|
-
grid.onFiltersChanged = new Slick.Event();
|
|
277
|
-
grid.onAfterFillDown = new Slick.Event();
|
|
278
|
-
}
|
|
279
|
-
function setupChangeEvents() {
|
|
280
|
-
dataView.onRowsChanged.subscribe(function (e, args) {
|
|
281
|
-
grid.invalidateRows(args.rows);
|
|
282
|
-
grid.render();
|
|
283
|
-
// for (let idx = 0; idx < args.rows.length; idx++) {
|
|
284
|
-
// grid.updateRow(args.rows[idx]);
|
|
285
|
-
// }
|
|
286
|
-
// grid.invalidate();
|
|
287
|
-
});
|
|
288
|
-
dataView.onRowCountChanged.subscribe(function (e, args) {
|
|
289
|
-
grid.updateRowCount();
|
|
290
|
-
grid.render();
|
|
291
|
-
});
|
|
292
|
-
grid.onAddNewRow.subscribe(function (e, args) {
|
|
293
|
-
var options = grid.getOptions();
|
|
294
|
-
if (options.provideDefaultValues != null) {
|
|
295
|
-
var result = options.provideDefaultValues(args.item);
|
|
296
|
-
if (result === false) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
dataView.addItem(args.item);
|
|
301
|
-
grid.onAfterEdit.notify({
|
|
302
|
-
grid: grid,
|
|
303
|
-
oldValue: undefined,
|
|
304
|
-
newValue: grid.getDataItemValueForColumn(args.item, args.column),
|
|
305
|
-
column: args.column,
|
|
306
|
-
item: args.item
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
function setupDefaultSort() {
|
|
311
|
-
var options = grid.getOptions();
|
|
312
|
-
if (options.mode === "client") {
|
|
313
|
-
grid.onSort.subscribe(function (e, args) {
|
|
314
|
-
sort(args.sortCol, args.sortAsc);
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
// TODO: multi column sort
|
|
318
|
-
}
|
|
319
|
-
function setupHeaderButtons() {
|
|
320
|
-
headerButtons = new HeaderButtons({});
|
|
321
|
-
grid.registerPlugin(headerButtons);
|
|
322
|
-
}
|
|
323
|
-
function setupHeaderMenu() {
|
|
324
|
-
headerMenu = new HeaderMenu({});
|
|
325
|
-
grid.registerPlugin(headerMenu);
|
|
326
|
-
headerMenu.onBeforeMenuShow.subscribe(function (e, args) {
|
|
327
|
-
var column = args.column;
|
|
328
|
-
var menu = args.menu;
|
|
329
|
-
if (column.sortable) {
|
|
330
|
-
menu.items.push({
|
|
331
|
-
title: UILang.grid.Sort + " " + UILang.grid.Asc,
|
|
332
|
-
command: "sort-asc"
|
|
333
|
-
});
|
|
334
|
-
menu.items.push({
|
|
335
|
-
title: UILang.grid.Sort + " " + UILang.grid.Desc,
|
|
336
|
-
command: "sort-desc"
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
if (column.filterable) {
|
|
340
|
-
menu.items.push({
|
|
341
|
-
title: UILang.grid.Filter,
|
|
342
|
-
command: "filter"
|
|
343
|
-
});
|
|
344
|
-
if (filters.filter(function (f) { return f.columnId === column.id; }).length > 0) {
|
|
345
|
-
menu.items.push({
|
|
346
|
-
title: UILang.grid.ClearFilter,
|
|
347
|
-
command: "clear-filter"
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
headerMenu.onCommand.subscribe(function (e, args) {
|
|
353
|
-
if (args.command === "sort-asc" || args.command === "sort-desc") {
|
|
354
|
-
grid.onSort.notify({
|
|
355
|
-
sortAsc: args.command === "sort-asc",
|
|
356
|
-
sortCol: args.column,
|
|
357
|
-
columnId: args.column.id,
|
|
358
|
-
sortCols: [{ columnId: args.column.id, sortCol: args.column, sortAsc: args.command === "sort-asc" }],
|
|
359
|
-
multiColumnSort: false
|
|
360
|
-
}, e);
|
|
361
|
-
// sort(args.column, args.command === "sort-asc");
|
|
362
|
-
}
|
|
363
|
-
else if (args.command === "filter") {
|
|
364
|
-
var options = grid.getOptions();
|
|
365
|
-
if (options.showFilterDialog != null) {
|
|
366
|
-
options.showFilterDialog(args.column, grid);
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
new ExcelFilter(grid).show(args.column);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
else if (args.command === "clear-filter") {
|
|
373
|
-
clearFilter(args.column.id);
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
// refresh formulas depending on the given column
|
|
378
|
-
function triggerFormula(column, item) {
|
|
379
|
-
var options = grid.getOptions();
|
|
380
|
-
var f = formulas[column];
|
|
381
|
-
if (f) {
|
|
382
|
-
for (var i = 0, l = f.length; i < l; i++) {
|
|
383
|
-
if (options.setDataItemValueForColumn != null) {
|
|
384
|
-
options.setDataItemValueForColumn(item, f[i].column, f[i].fnc(item, column));
|
|
385
|
-
}
|
|
386
|
-
else {
|
|
387
|
-
item[f[i].column] = f[i].fnc(item, column);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
function handleEditCommand(item, column, editCommand) {
|
|
393
|
-
var options = grid.getOptions();
|
|
394
|
-
var oldVal = grid.getDataItemValueForColumn(item, column);
|
|
395
|
-
if (customCommandHandler) {
|
|
396
|
-
customCommandHandler(item, column, editCommand);
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
editCommand.execute();
|
|
400
|
-
}
|
|
401
|
-
triggerFormula(column.field, item);
|
|
402
|
-
dataView.updateItem(item[options.primaryKey], item);
|
|
403
|
-
var afterEditResult = grid.onAfterEdit.notify({
|
|
404
|
-
grid: grid,
|
|
405
|
-
oldValue: oldVal,
|
|
406
|
-
newValue: grid.getDataItemValueForColumn(item, column),
|
|
407
|
-
column: column,
|
|
408
|
-
item: item
|
|
409
|
-
});
|
|
410
|
-
if (afterEditResult === false) {
|
|
411
|
-
if (options.setDataItemValueForColumn != null) {
|
|
412
|
-
options.setDataItemValueForColumn(item, column, oldVal);
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
item[column.field] = oldVal;
|
|
416
|
-
}
|
|
417
|
-
triggerFormula(column.field, item);
|
|
418
|
-
dataView.updateItem(item[options.primaryKey], item);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function setHeight(height) {
|
|
422
|
-
$(container).height(height);
|
|
423
|
-
grid.resizeCanvas();
|
|
424
|
-
}
|
|
425
|
-
function getHeight() {
|
|
426
|
-
return $(container).height();
|
|
427
|
-
}
|
|
428
|
-
function sort(column, sortAsc) {
|
|
429
|
-
function _comparer(a, b) {
|
|
430
|
-
var x = grid.getDataItemValueForColumn(a, column);
|
|
431
|
-
var y = grid.getDataItemValueForColumn(b, column);
|
|
432
|
-
if (typeof x === "string" && typeof y === "string") {
|
|
433
|
-
x = x.toLocaleLowerCase();
|
|
434
|
-
y = y.toLocaleLowerCase();
|
|
435
|
-
}
|
|
436
|
-
if (x == null && y != null) {
|
|
437
|
-
return -1;
|
|
438
|
-
}
|
|
439
|
-
else if (x != null && y == null) {
|
|
440
|
-
return 1;
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
return (x === y ? 0 : (x > y ? 1 : -1));
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
function _visibleComparer(a, b) {
|
|
447
|
-
var x = column.formatter(0, 0, grid.getDataItemValueForColumn(a, column), column, a);
|
|
448
|
-
var y = column.formatter(0, 0, grid.getDataItemValueForColumn(b, column), column, b);
|
|
449
|
-
var xStr = (Object.prototype.toString.call(x) !== "[object Object]" ? x : x.text);
|
|
450
|
-
var yStr = (Object.prototype.toString.call(y) !== "[object Object]" ? y : y.text);
|
|
451
|
-
if (typeof x === "string" && typeof y === "string") {
|
|
452
|
-
xStr = x.toLocaleLowerCase();
|
|
453
|
-
yStr = y.toLocaleLowerCase();
|
|
454
|
-
}
|
|
455
|
-
return (xStr === yStr ? 0 : (xStr > yStr ? 1 : -1));
|
|
456
|
-
}
|
|
457
|
-
var comparer = column.comparer || (column.sortByVisibleValue ? _visibleComparer : _comparer);
|
|
458
|
-
dataView.sort(comparer, sortAsc ? true : false);
|
|
459
|
-
}
|
|
460
|
-
function setData(newData) {
|
|
461
|
-
data = newData;
|
|
462
|
-
dataView.setItems(data);
|
|
463
|
-
refresh();
|
|
464
|
-
}
|
|
465
|
-
function getData() {
|
|
466
|
-
return data;
|
|
467
|
-
}
|
|
468
|
-
function refreshData() {
|
|
469
|
-
// var selrows = self.getSelectedRows();
|
|
470
|
-
dataView.setItems(data);
|
|
471
|
-
// self.setSelectedRows(selrows);
|
|
472
|
-
refresh();
|
|
473
|
-
}
|
|
474
|
-
function refresh() {
|
|
475
|
-
grid.invalidate();
|
|
476
|
-
}
|
|
477
|
-
function addFormula(field, fnc, usedColumns) {
|
|
478
|
-
formulaObjects.push({ fnc: fnc, column: field });
|
|
479
|
-
for (var i = 0; i < usedColumns.length; i++) {
|
|
480
|
-
if (!formulas[usedColumns[i]]) {
|
|
481
|
-
formulas[usedColumns[i]] = [];
|
|
482
|
-
}
|
|
483
|
-
formulas[usedColumns[i]].push({ fnc: fnc, column: field });
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* returns the string representation of a value based on column settings
|
|
488
|
-
*/
|
|
489
|
-
function getFormattedValue(column, value, item) {
|
|
490
|
-
var formatter = column.formatter || TextFormatter;
|
|
491
|
-
var formatterResult = formatter(0, 0, value, column, item, grid);
|
|
492
|
-
return (Object.prototype.toString.call(formatterResult) !== "[object Object]" ?
|
|
493
|
-
formatterResult :
|
|
494
|
-
(formatterResult.text));
|
|
495
|
-
}
|
|
496
|
-
function getContentWidth(column, row) {
|
|
497
|
-
var item = dataView.getItem(row);
|
|
498
|
-
var html = getFormattedValue(column, grid.getDataItemValueForColumn(item, column), item);
|
|
499
|
-
if (html.indexOf("<") >= 0) {
|
|
500
|
-
return calcLengthInternal(html, true) + 12;
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
if (convertElement == null) {
|
|
504
|
-
convertElement = document.createElement("span");
|
|
505
|
-
}
|
|
506
|
-
convertElement.innerHTML = html;
|
|
507
|
-
return calcTextLength(convertElement.textContent) + 12;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
var measureElement;
|
|
511
|
-
var convertElement;
|
|
512
|
-
var charWidth = {};
|
|
513
|
-
function calcTextLength(text) {
|
|
514
|
-
var result = 0;
|
|
515
|
-
for (var i = 0; i < text.length; i++) {
|
|
516
|
-
var c = text[i];
|
|
517
|
-
var w = charWidth[c];
|
|
518
|
-
if (w == null) {
|
|
519
|
-
charWidth[c] = w = calcLengthInternal(c, false);
|
|
520
|
-
}
|
|
521
|
-
result += w;
|
|
522
|
-
}
|
|
523
|
-
return result;
|
|
524
|
-
}
|
|
525
|
-
function calcLengthInternal(c, isHTML) {
|
|
526
|
-
if (measureElement == null) {
|
|
527
|
-
measureElement = document.createElement("span");
|
|
528
|
-
measureElement.style.top = "-100000px";
|
|
529
|
-
measureElement.style.position = "absolute";
|
|
530
|
-
measureElement.style.whiteSpace = "pre";
|
|
531
|
-
document.body.appendChild(measureElement);
|
|
532
|
-
grid.onBeforeDestroy.subscribe(function () {
|
|
533
|
-
if (measureElement.parentElement != null) {
|
|
534
|
-
measureElement.parentElement.removeChild(measureElement);
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
if (isHTML) {
|
|
539
|
-
measureElement.innerHTML = c;
|
|
540
|
-
}
|
|
541
|
-
else {
|
|
542
|
-
measureElement.textContent = c;
|
|
543
|
-
}
|
|
544
|
-
return measureElement.getBoundingClientRect().width;
|
|
545
|
-
}
|
|
546
|
-
function fitToContent(column) {
|
|
547
|
-
var width = 10;
|
|
548
|
-
for (var idx = 0, len = grid.getDataLength(); idx < len; idx++) {
|
|
549
|
-
//const d = grid.getDataItem(idx);
|
|
550
|
-
width = Math.max(width, getContentWidth(column, idx));
|
|
551
|
-
}
|
|
552
|
-
column.width = width;
|
|
553
|
-
grid.setColumns(grid.getColumns());
|
|
554
|
-
// TODO: raise column resize event
|
|
555
|
-
// TODO (2): find more performant way to refresh columns
|
|
556
|
-
}
|
|
557
|
-
function triggerAllFormulas() {
|
|
558
|
-
if (formulaObjects.length === 0) {
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
for (var j = 0; j < formulaObjects.length; j++) {
|
|
562
|
-
for (var i = 0; i < data.length; i++) {
|
|
563
|
-
var val = formulaObjects[j].fnc(data[i], grid, formulaObjects[j].column);
|
|
564
|
-
data[i][formulaObjects[j].column] = val;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
refreshData();
|
|
568
|
-
}
|
|
569
|
-
function columnHasFilter(columnId) {
|
|
570
|
-
for (var i = 0, l = (filters ? filters.length : 0); i < l; i++) {
|
|
571
|
-
if (filters[i].columnId === columnId) {
|
|
572
|
-
return true;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
return false;
|
|
576
|
-
}
|
|
577
|
-
function refreshDataItem(item) {
|
|
578
|
-
var options = grid.getOptions();
|
|
579
|
-
dataView.updateItem(item[options.primaryKey], item);
|
|
580
|
-
// formula refresh
|
|
581
|
-
for (var f in formulas) {
|
|
582
|
-
if (formulas.hasOwnProperty(f)) {
|
|
583
|
-
triggerFormula(f, item);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
grid.updateRow(dataView.getRowByItem(item));
|
|
587
|
-
}
|
|
588
|
-
function addFilter(filter, dontrefresh) {
|
|
589
|
-
var filterArray;
|
|
590
|
-
if (Array.isArray(filter)) {
|
|
591
|
-
filterArray = filter;
|
|
592
|
-
}
|
|
593
|
-
else {
|
|
594
|
-
filterArray = [filter];
|
|
595
|
-
}
|
|
596
|
-
for (var idx = 0; idx < filterArray.length; idx++) {
|
|
597
|
-
// add filter
|
|
598
|
-
filters.push(filterArray[idx]);
|
|
599
|
-
}
|
|
600
|
-
if (!dontrefresh) {
|
|
601
|
-
refreshFilters();
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
function setFilters(f, dontrefresh) {
|
|
605
|
-
filters = f;
|
|
606
|
-
if (!dontrefresh) {
|
|
607
|
-
refreshFilters();
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
function getFilters() {
|
|
611
|
-
return filters;
|
|
612
|
-
}
|
|
613
|
-
function clearFilter(columnId, dontrefresh) {
|
|
614
|
-
if (columnId === undefined) { // clear all filters
|
|
615
|
-
filters.length = 0;
|
|
616
|
-
}
|
|
617
|
-
else {
|
|
618
|
-
for (var i = 0; i < filters.length; i++) {
|
|
619
|
-
if (filters[i].columnId === columnId) {
|
|
620
|
-
filters.splice(i, 1);
|
|
621
|
-
i--;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
if (!dontrefresh) {
|
|
626
|
-
refreshFilters();
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
function refreshFilters(noColumnHeaderRefresh) {
|
|
630
|
-
var options = grid.getOptions();
|
|
631
|
-
function client_filter(item, args) {
|
|
632
|
-
var filterArray = args;
|
|
633
|
-
// no filter present -> show all rows
|
|
634
|
-
if (filterArray.length === 0) {
|
|
635
|
-
return true;
|
|
636
|
-
}
|
|
637
|
-
if (filterArray.length === 1) {
|
|
638
|
-
return filterArray[0].match.call(null, item, filterArray[0].field);
|
|
639
|
-
}
|
|
640
|
-
else {
|
|
641
|
-
var result = true;
|
|
642
|
-
var i = 0;
|
|
643
|
-
while (i < filterArray.length) {
|
|
644
|
-
var orResult = false;
|
|
645
|
-
while (i < filterArray.length) { // combine or(s)
|
|
646
|
-
if (orResult || filterArray[i].match.call(null, item, filterArray[i].field)) {
|
|
647
|
-
orResult = true;
|
|
648
|
-
}
|
|
649
|
-
if (filterArray[i].combine !== "or") {
|
|
650
|
-
break;
|
|
651
|
-
}
|
|
652
|
-
else {
|
|
653
|
-
i++;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
if (!orResult) {
|
|
657
|
-
result = false;
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
i++;
|
|
661
|
-
}
|
|
662
|
-
return result;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
if (options.mode === "client") {
|
|
666
|
-
dataView.setFilterArgs(filters);
|
|
667
|
-
dataView.setFilter(client_filter);
|
|
668
|
-
}
|
|
669
|
-
// redraw columns
|
|
670
|
-
if (!noColumnHeaderRefresh) {
|
|
671
|
-
grid.setColumns(grid.getColumns());
|
|
672
|
-
}
|
|
673
|
-
grid.onFiltersChanged.notify();
|
|
674
|
-
}
|
|
675
|
-
function getSelectedItems() {
|
|
676
|
-
var selRows = grid.getSelectedRows();
|
|
677
|
-
var rows = [];
|
|
678
|
-
for (var i = 0; i < selRows.length; i++) {
|
|
679
|
-
var rowIdx = selRows[i];
|
|
680
|
-
var toPush = dataView.getItem(rowIdx);
|
|
681
|
-
if (toPush !== undefined && !toPush.__group && !toPush.__groupTotals) {
|
|
682
|
-
rows.push(toPush);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
return rows;
|
|
686
|
-
}
|
|
687
|
-
function getRowMoveManager() {
|
|
688
|
-
return rowMoveManager;
|
|
689
|
-
}
|
|
690
|
-
function getHeaderMenu() {
|
|
691
|
-
return headerMenu;
|
|
692
|
-
}
|
|
693
|
-
// function setHierachy(o: IGridTreeOptions): GridTree {
|
|
694
|
-
// return new GridTree(this, o);
|
|
695
|
-
// }
|
|
696
|
-
createMe();
|
|
697
|
-
return $.shallowExtend(grid, {
|
|
698
|
-
dataView: dataView,
|
|
699
|
-
setHeight: setHeight,
|
|
700
|
-
getHeight: getHeight,
|
|
701
|
-
sort: sort,
|
|
702
|
-
refreshData: refreshData,
|
|
703
|
-
setData: setData,
|
|
704
|
-
getData: getData,
|
|
705
|
-
refresh: refresh,
|
|
706
|
-
addFormula: addFormula,
|
|
707
|
-
getFormattedValue: getFormattedValue,
|
|
708
|
-
getContentWidth: getContentWidth,
|
|
709
|
-
fitToContent: fitToContent,
|
|
710
|
-
triggerAllFormulas: triggerAllFormulas,
|
|
711
|
-
columnHasFilter: columnHasFilter,
|
|
712
|
-
refreshDataItem: refreshDataItem,
|
|
713
|
-
addFilter: addFilter,
|
|
714
|
-
setFilters: setFilters,
|
|
715
|
-
getFilters: getFilters,
|
|
716
|
-
clearFilter: clearFilter,
|
|
717
|
-
refreshFilters: refreshFilters,
|
|
718
|
-
getSelectedItems: getSelectedItems,
|
|
719
|
-
getRowMoveManager: getRowMoveManager,
|
|
720
|
-
getHeaderMenu: getHeaderMenu // ,
|
|
721
|
-
// setHierachy
|
|
722
|
-
});
|
|
723
|
-
}
|