react-graph-grid 0.1.3 → 0.1.5
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/README.md +4 -0
- package/dist/index.esm.js +21 -0
- package/dist/index.js +56 -0
- package/dist/index10.esm.js +3844 -0
- package/dist/index10.js +3848 -0
- package/dist/index11.esm.js +4121 -0
- package/dist/index11.js +4125 -0
- package/dist/index12.esm.js +5238 -0
- package/dist/index12.js +5242 -0
- package/dist/index13.esm.js +5466 -0
- package/dist/index13.js +5470 -0
- package/dist/index14.esm.js +22 -0
- package/dist/index14.js +26 -0
- package/dist/index15.esm.js +402 -0
- package/dist/index15.js +403 -0
- package/dist/index16.esm.js +507 -0
- package/dist/index16.js +507 -0
- package/dist/index17.esm.js +256 -0
- package/dist/index17.js +257 -0
- package/dist/index18.esm.js +261 -0
- package/dist/index18.js +263 -0
- package/dist/index19.esm.js +623 -0
- package/dist/index19.js +624 -0
- package/dist/index2.esm.js +6 -0
- package/dist/index2.js +2 -0
- package/dist/index20.esm.js +219 -0
- package/dist/index20.js +220 -0
- package/dist/index21.esm.js +298 -0
- package/dist/index21.js +299 -0
- package/dist/index22.esm.js +662 -0
- package/dist/index22.js +663 -0
- package/dist/index23.esm.js +340 -0
- package/dist/index23.js +341 -0
- package/dist/index24.esm.js +269 -0
- package/dist/index24.js +270 -0
- package/dist/index25.esm.js +600 -0
- package/dist/index25.js +601 -0
- package/dist/index26.esm.js +245 -0
- package/dist/index26.js +246 -0
- package/dist/index27.esm.js +136 -0
- package/dist/index27.js +137 -0
- package/dist/index28.esm.js +70 -0
- package/dist/index28.js +70 -0
- package/dist/index29.esm.js +748 -0
- package/dist/index29.js +748 -0
- package/dist/index30.esm.js +363 -0
- package/dist/index30.js +363 -0
- package/dist/index4.esm.js +27 -0
- package/dist/index4.js +27 -0
- package/dist/index5.esm.js +35 -0
- package/dist/index5.js +39 -0
- package/dist/index6.esm.js +200 -0
- package/dist/index6.js +204 -0
- package/dist/index7.esm.js +9 -0
- package/dist/index7.js +13 -0
- package/dist/index8.esm.js +65 -0
- package/dist/index8.js +68 -0
- package/dist/index9.esm.js +102 -0
- package/dist/index9.js +103 -0
- package/{src/css/default.css → dist/react-graph-grid.css} +2 -1
- package/package.json +6 -6
- package/eslint.config.js +0 -29
- package/index.html +0 -13
- package/index.js +0 -19
- package/npm.aps +0 -0
- package/src/Base.jsx +0 -81
- package/src/Card.jsx +0 -333
- package/src/Dropdown.jsx +0 -339
- package/src/FieldEdit.jsx +0 -376
- package/src/Graph.jsx +0 -482
- package/src/Grid.jsx +0 -887
- package/src/GridCD.jsx +0 -180
- package/src/GridDB.jsx +0 -897
- package/src/GridFE.jsx +0 -753
- package/src/GridFL.jsx +0 -468
- package/src/GridGR.jsx +0 -311
- package/src/GridPK.jsx +0 -414
- package/src/Modal.jsx +0 -511
- package/src/Overlay.jsx +0 -140
- package/src/Tests/DebugApp.jsx +0 -334
- package/src/Tests/TestData.jsx +0 -251
- package/src/Themes/DefaultGridTheme.jsx +0 -36
- package/src/Themes/Images.jsx +0 -438
- package/src/Themes/Translate.jsx +0 -76
- package/src/css/default_.css +0 -945
- package/src/main.jsx +0 -10
- package/vite.config.js +0 -14
- /package/{public → dist}/IM.svg +0 -0
package/src/GridDB.jsx
DELETED
|
@@ -1,897 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-mixed-operators */
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import { Images } from './Themes/Images';
|
|
4
|
-
import { GridPKClass } from './GridPK';
|
|
5
|
-
import { Dropdown } from './Dropdown';
|
|
6
|
-
import { WaveType } from './Graph';
|
|
7
|
-
import { NodeStatus } from './Base';
|
|
8
|
-
import { BaseComponent } from './Base';
|
|
9
|
-
// ==================================================================================================================================================================
|
|
10
|
-
export function GridDB(props) {
|
|
11
|
-
let grid = null;
|
|
12
|
-
|
|
13
|
-
const [gridState, setState] = useState({ grid: grid, ind: 0 });
|
|
14
|
-
|
|
15
|
-
grid = gridState.grid;
|
|
16
|
-
let needGetRows = false;
|
|
17
|
-
if (!grid || grid.uid !== props.uid && props.uid != null) {
|
|
18
|
-
grid = null;
|
|
19
|
-
if (props.findGrid) {
|
|
20
|
-
grid = props.findGrid(props);
|
|
21
|
-
}
|
|
22
|
-
grid = grid || new GridDBClass(props);
|
|
23
|
-
needGetRows = !props.noAutoRefresh && !props.parentGrids;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (props.init) {
|
|
27
|
-
props.init(grid);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
grid.refreshState = function () {
|
|
31
|
-
setState({ grid: grid, ind: grid.stateind++ });
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
grid._waitingRows = needGetRows && (grid.rows.length <= 0 || grid.columns.length <= 0);
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
grid.setupEvents(grid);
|
|
38
|
-
|
|
39
|
-
if (grid._waitingRows) {
|
|
40
|
-
|
|
41
|
-
grid.getRows({ filters: grid.collectFilters(), grid: grid }).then(
|
|
42
|
-
rows => {
|
|
43
|
-
grid.rows = rows;
|
|
44
|
-
grid.afterGetRows();
|
|
45
|
-
grid.refreshState();
|
|
46
|
-
}
|
|
47
|
-
).finally(() => {
|
|
48
|
-
grid._waitingRows = false;
|
|
49
|
-
grid.refreshState();
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else if (grid.columns.length <= 0 && grid.getColumns) {
|
|
53
|
-
grid.prepareColumns().then(() => grid.refreshState());
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return () => {
|
|
57
|
-
grid.clearEvents();
|
|
58
|
-
}
|
|
59
|
-
}, [grid])
|
|
60
|
-
|
|
61
|
-
return (grid.render());
|
|
62
|
-
}
|
|
63
|
-
// ==================================================================================================================================================================
|
|
64
|
-
export class GridDBClass extends GridPKClass {
|
|
65
|
-
|
|
66
|
-
constructor(props) {
|
|
67
|
-
super(props);
|
|
68
|
-
|
|
69
|
-
const grid = this;
|
|
70
|
-
grid.pageNumber = 1;
|
|
71
|
-
grid.pageSize = props.pageSize === 0 ? 0 : props.pageSize || 10;
|
|
72
|
-
|
|
73
|
-
grid.pageSizes = [5, 10, 15, 20, 30, 40, 50, 100];
|
|
74
|
-
|
|
75
|
-
grid.buttons = props.buttons || [];
|
|
76
|
-
|
|
77
|
-
grid.sortDisabled = props.sortDisabled;
|
|
78
|
-
|
|
79
|
-
grid.opt.toolbarClass = props.toolbarClass;
|
|
80
|
-
grid.opt.toolbarButtonsClass = props.toolbarButtonsClass;
|
|
81
|
-
grid.opt.pagerClass = props.pagerClass;
|
|
82
|
-
grid.opt.pagerButtonsClass = props.pagerButtonsClass;
|
|
83
|
-
grid.opt.inputClass = props.inputClass;
|
|
84
|
-
|
|
85
|
-
grid.sortColumns = [];
|
|
86
|
-
grid._sortSeq = 1;
|
|
87
|
-
|
|
88
|
-
grid.multi = props.multi;
|
|
89
|
-
}
|
|
90
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
91
|
-
static gridSettings = {};
|
|
92
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
93
|
-
//visitByWaveOld(e) {
|
|
94
|
-
// const grid = this;
|
|
95
|
-
// if (grid.skipOnWaveVisit(e)) return;
|
|
96
|
-
|
|
97
|
-
// if (e.waveType === WaveType.value) {
|
|
98
|
-
// if (grid.status === NodeStatus.filter) {
|
|
99
|
-
// if (!grid._selecting) {
|
|
100
|
-
// grid.selectedRowIndex = -1;
|
|
101
|
-
// }
|
|
102
|
-
// grid.value = grid.text = '';
|
|
103
|
-
// grid._selectedOptions = [];
|
|
104
|
-
// return;
|
|
105
|
-
// }
|
|
106
|
-
// }
|
|
107
|
-
|
|
108
|
-
// grid.pageNumber = 1;
|
|
109
|
-
|
|
110
|
-
// super.visitByWaveOld(e);
|
|
111
|
-
//}
|
|
112
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
113
|
-
visitByWave(e) {
|
|
114
|
-
const grid = this;
|
|
115
|
-
|
|
116
|
-
const rpr = new Promise(function (resolve) {
|
|
117
|
-
resolve(e);
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
if (grid.skipOnWaveVisit(e)) return rpr;
|
|
121
|
-
|
|
122
|
-
if (e.waveType === WaveType.value) {
|
|
123
|
-
if (grid.status === NodeStatus.filter) {
|
|
124
|
-
if (!grid._selecting) {
|
|
125
|
-
grid.selectedRowIndex = -1;
|
|
126
|
-
}
|
|
127
|
-
grid.value = grid.text = '';
|
|
128
|
-
grid._selectedOptions = [];
|
|
129
|
-
return rpr;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
grid.pageNumber = 1;
|
|
134
|
-
|
|
135
|
-
return super.visitByWave(e);
|
|
136
|
-
}
|
|
137
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
138
|
-
keyAdd() {
|
|
139
|
-
const grid = this;
|
|
140
|
-
return `${super.keyAdd()}_${grid.pageSize}_${grid.pageNumber}_`;
|
|
141
|
-
}
|
|
142
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
143
|
-
render() {
|
|
144
|
-
const grid = this;
|
|
145
|
-
grid.setupPagerButtons();
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<>
|
|
149
|
-
{grid.renderToolbar()}
|
|
150
|
-
{/*grid.renderAppliedFilters()*/}
|
|
151
|
-
{grid.renderPager()}
|
|
152
|
-
{super.render()}
|
|
153
|
-
{grid.renderPager(true)}
|
|
154
|
-
<Dropdown
|
|
155
|
-
init={(dd) => {
|
|
156
|
-
grid.menuDropdown = dd;
|
|
157
|
-
dd._grid = grid;
|
|
158
|
-
}}
|
|
159
|
-
closeWhenMiss={true}
|
|
160
|
-
getItems={(e) => { return e.self._grid.getGridSettings(e); }}
|
|
161
|
-
onItemClick={(e) => { e.self._grid.onSettingsItemClick(e.itemId); }}>
|
|
162
|
-
</Dropdown>
|
|
163
|
-
</>
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
167
|
-
isDisabled() {
|
|
168
|
-
const grid = this;
|
|
169
|
-
return grid._isDisabled === true;
|
|
170
|
-
}
|
|
171
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
172
|
-
setDisabled(value) {
|
|
173
|
-
const grid = this;
|
|
174
|
-
grid._isDisabled = value;
|
|
175
|
-
}
|
|
176
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
177
|
-
isEditing() {
|
|
178
|
-
const grid = this;
|
|
179
|
-
return grid._isEditing === true;
|
|
180
|
-
}
|
|
181
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
182
|
-
setEditing(value) {
|
|
183
|
-
const grid = this;
|
|
184
|
-
grid._isEditing = value;
|
|
185
|
-
}
|
|
186
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
187
|
-
renderToolbar() {
|
|
188
|
-
const grid = this;
|
|
189
|
-
grid.buttons = grid.buttons || [];
|
|
190
|
-
return (
|
|
191
|
-
false ?
|
|
192
|
-
<div
|
|
193
|
-
|
|
194
|
-
key={`gridToolbarDiv_${grid.id}_`}
|
|
195
|
-
className={grid.opt.toolbarClass || BaseComponent.theme.toolbarClass || 'toolbar-default'}
|
|
196
|
-
>
|
|
197
|
-
{
|
|
198
|
-
grid.buttons.map((button, ind) => {
|
|
199
|
-
return (
|
|
200
|
-
button.getVisible && !button.getVisible() ? <span key={`toolbarEmpty_${grid.id}_${button.id}_${ind}_`}></span> :
|
|
201
|
-
<button
|
|
202
|
-
key={`toolbarButton_${grid.id}_${button.id}_${ind}_`}
|
|
203
|
-
></button>
|
|
204
|
-
)
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
:
|
|
210
|
-
|
|
211
|
-
grid.buttons.length <= 0 ? <></> :
|
|
212
|
-
<div
|
|
213
|
-
|
|
214
|
-
key={`gridToolbarDiv_${grid.id}_`}
|
|
215
|
-
className={grid.opt.toolbarClass || 'toolbar-default'}
|
|
216
|
-
>
|
|
217
|
-
{
|
|
218
|
-
grid.buttons.map((button, ind) => {
|
|
219
|
-
return (
|
|
220
|
-
button.render ?
|
|
221
|
-
button.render()
|
|
222
|
-
:
|
|
223
|
-
<button
|
|
224
|
-
key={`toolbarButton_${grid.id}_${button.id}_${ind}_`}
|
|
225
|
-
className={`${button.class || grid.opt.toolbarButtonsClass || BaseComponent.theme.toolbarButtonsClass || 'grid-toolbar-button'}`}
|
|
226
|
-
style={{
|
|
227
|
-
width: button.w ? button.w : button.img ? '' : 'auto',
|
|
228
|
-
display: button.getVisible && !button.getVisible() ? 'none' : '',
|
|
229
|
-
padding: button.padding ? button.padding : '',
|
|
230
|
-
margin: '5px 2px',
|
|
231
|
-
}}
|
|
232
|
-
title={grid.translate(button.title, 'grid-toolbar-button')}
|
|
233
|
-
disabled={button.getDisabled && button.getDisabled({ grid: grid }) || button.disabled ? 'disabled' : ''}
|
|
234
|
-
onClick={button.click ? (e) => {
|
|
235
|
-
e.grid = grid;
|
|
236
|
-
button.click(e);
|
|
237
|
-
} : grid.onButtonClick ? (e) => { grid.onButtonClick(e) } : null}
|
|
238
|
-
>
|
|
239
|
-
{button.img ? button.img() : ''}
|
|
240
|
-
{GridDBClass.gridSettings.buttonSize > 0 || !button.img ? grid.translate(button.label, 'grid-toolbar-button') || grid.translate(button.title, 'grid-toolbar-button') : ''}
|
|
241
|
-
</button>
|
|
242
|
-
);
|
|
243
|
-
})
|
|
244
|
-
}
|
|
245
|
-
</div>
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
249
|
-
renderAppliedFilters() {
|
|
250
|
-
return <></>;
|
|
251
|
-
}
|
|
252
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
253
|
-
renderPager(bottom) {
|
|
254
|
-
const grid = this;
|
|
255
|
-
|
|
256
|
-
return (
|
|
257
|
-
grid.pagerButtons.length <= 0 || bottom && !grid.allowBottomPager ? <></> :
|
|
258
|
-
<div
|
|
259
|
-
key={`pagerDiv_${bottom ? 'bottom' : 'top'}_${grid.id}_`}
|
|
260
|
-
className={grid.opt.pagerClass || BaseComponent.theme.pagerClass || 'grid-pager-default'}
|
|
261
|
-
style={{ display: 'flex', alignItems: 'center' }}
|
|
262
|
-
>
|
|
263
|
-
{
|
|
264
|
-
grid.pagerButtons.map((button, ind) => {
|
|
265
|
-
return (
|
|
266
|
-
button.render ? button.render(button, bottom) :
|
|
267
|
-
<button
|
|
268
|
-
key={`pager_${bottom ? 'bottom' : 'top'}_${grid.id}_${button.id}_${ind}_`}
|
|
269
|
-
grid-pager-item={`${grid.id}_${button.id}_`}
|
|
270
|
-
className={`${button.class || BaseComponent.theme.pagerButtonsClass || 'grid-pager-button'}`}
|
|
271
|
-
title={grid.translate(button.title, 'grid-pager-button')}
|
|
272
|
-
disabled={grid.isEditing() || grid.isDisabled() || button.getDisabled && button.getDisabled({ grid: grid }) || button.disabled ? 'disabled' : ''}
|
|
273
|
-
onClick={button.click ? button.click : null}
|
|
274
|
-
style={{ margin: '5px 2px', minHeight: '2em', display: 'flex' }}
|
|
275
|
-
>
|
|
276
|
-
{button.img ? button.img() : ''}
|
|
277
|
-
{button.label ? grid.translate(button.label, 'grid-pager-button') : ''}
|
|
278
|
-
</button>
|
|
279
|
-
);
|
|
280
|
-
})
|
|
281
|
-
}
|
|
282
|
-
</div>
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
286
|
-
gotoFirstPage() {
|
|
287
|
-
const grid = this;
|
|
288
|
-
grid.pageNumber = 1;
|
|
289
|
-
grid.selectedRowIndex = 0;
|
|
290
|
-
grid.refresh();
|
|
291
|
-
}
|
|
292
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
293
|
-
gotoPrevPage() {
|
|
294
|
-
const grid = this;
|
|
295
|
-
grid.pageNumber = grid.pageNumber > 1 ? grid.pageNumber - 1 : 1;
|
|
296
|
-
grid.selectedRowIndex = 0;
|
|
297
|
-
grid.refresh();
|
|
298
|
-
}
|
|
299
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
300
|
-
gotoNextPage() {
|
|
301
|
-
const grid = this;
|
|
302
|
-
grid.calculatePagesCount();
|
|
303
|
-
grid.pageNumber = grid.pageNumber < grid.pagesCount ? grid.pageNumber + 1 : grid.pageNumber;
|
|
304
|
-
grid.selectedRowIndex = 0;
|
|
305
|
-
grid.refresh();
|
|
306
|
-
}
|
|
307
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
308
|
-
gotoLastPage() {
|
|
309
|
-
const grid = this;
|
|
310
|
-
grid.calculatePagesCount();
|
|
311
|
-
grid.pageNumber = grid.pageNumber < grid.pagesCount ? grid.pagesCount : grid.pageNumber;
|
|
312
|
-
grid.selectedRowIndex = 0;
|
|
313
|
-
grid.refresh();
|
|
314
|
-
}
|
|
315
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
316
|
-
setupPagerButtons() {
|
|
317
|
-
const grid = this;
|
|
318
|
-
if (grid.pagerButtons && grid.pagerButtons.length > 0) return;
|
|
319
|
-
|
|
320
|
-
grid.pagerButtons = [];
|
|
321
|
-
grid.pagerButtonsDict = {};
|
|
322
|
-
|
|
323
|
-
const refresh = {
|
|
324
|
-
id: 0,
|
|
325
|
-
name: 'refresh',
|
|
326
|
-
title: 'Refresh',
|
|
327
|
-
label: Images.images.refresh ? '' : 'Refresh',
|
|
328
|
-
click: function (e) {
|
|
329
|
-
grid.refresh();
|
|
330
|
-
},
|
|
331
|
-
img: Images.images.refresh,
|
|
332
|
-
class: grid.pagerButtonsClass,
|
|
333
|
-
getDisabled: function () {
|
|
334
|
-
return grid._waitingRows;
|
|
335
|
-
},
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
grid.pagerButtons.push(refresh);
|
|
339
|
-
grid.pagerButtonsDict[refresh.id] = grid.pagerButtonsDict[refresh.name] = refresh;
|
|
340
|
-
|
|
341
|
-
if (grid.showGridSettings) {
|
|
342
|
-
const settings = {
|
|
343
|
-
id: 1,
|
|
344
|
-
name: 'settings',
|
|
345
|
-
title: 'Settings',
|
|
346
|
-
label: Images.images.settings ? '' : 'Settings',
|
|
347
|
-
click: function (e) {
|
|
348
|
-
grid.showGridSettings(e);
|
|
349
|
-
},
|
|
350
|
-
img: Images.images.settings,
|
|
351
|
-
class: grid.pagerButtonsClass,
|
|
352
|
-
getDisabled: function () {
|
|
353
|
-
return grid._waitingRows;
|
|
354
|
-
},
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
grid.pagerButtons.push(settings);
|
|
358
|
-
grid.pagerButtonsDict[settings.id] = grid.pagerButtonsDict[settings.name] = settings;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (grid.multi) {
|
|
362
|
-
const pocket = {
|
|
363
|
-
id: 2,
|
|
364
|
-
name: 'pocket',
|
|
365
|
-
title: 'Pocket',
|
|
366
|
-
label: Images.images.pocket ? '' : 'Pocket',
|
|
367
|
-
click: function (e) {
|
|
368
|
-
grid.switchGridPocket(e);
|
|
369
|
-
},
|
|
370
|
-
img: grid.pocketOpened ? Images.images.pocketOpened : Images.images.pocket,
|
|
371
|
-
class: grid.pagerButtonsClass,
|
|
372
|
-
getDisabled: function () {
|
|
373
|
-
return grid._waitingRows;
|
|
374
|
-
},
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
grid.pagerButtons.push(pocket);
|
|
378
|
-
grid.pagerButtonsDict[pocket.id] = grid.pagerButtonsDict[pocket.name] = pocket;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
if (grid.pageSize > 0) {
|
|
382
|
-
|
|
383
|
-
const first = {
|
|
384
|
-
id: 3,
|
|
385
|
-
name: 'first',
|
|
386
|
-
title: 'First',
|
|
387
|
-
label: Images.images.first ? '' : 'First',
|
|
388
|
-
click: function (e) {
|
|
389
|
-
grid.gotoFirstPage();
|
|
390
|
-
},
|
|
391
|
-
getDisabled: function () {
|
|
392
|
-
return grid._waitingRows || !grid.rows || grid.rows.length <= 0 || grid.pageNumber === 1;
|
|
393
|
-
},
|
|
394
|
-
img: Images.images.first,
|
|
395
|
-
class: grid.pagerButtonsClass,
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
grid.pagerButtons.push(first);
|
|
399
|
-
grid.pagerButtonsDict[first.id] = grid.pagerButtonsDict[first.name] = first;
|
|
400
|
-
|
|
401
|
-
const prev = {
|
|
402
|
-
id: 4,
|
|
403
|
-
name: 'prev',
|
|
404
|
-
title: 'Prev',
|
|
405
|
-
label: Images.images.prev ? '' : 'Prev',
|
|
406
|
-
click: function (e) {
|
|
407
|
-
grid.gotoPrevPage();
|
|
408
|
-
},
|
|
409
|
-
getDisabled: function () {
|
|
410
|
-
return grid._waitingRows || !grid.rows || grid.rows.length <= 0 || grid.pageNumber === 1;
|
|
411
|
-
},
|
|
412
|
-
img: Images.images.prev,
|
|
413
|
-
class: grid.pagerButtonsClass,
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
grid.pagerButtons.push(prev);
|
|
417
|
-
grid.pagerButtonsDict[prev.id] = grid.pagerButtonsDict[prev.name] = prev;
|
|
418
|
-
|
|
419
|
-
const curr = {
|
|
420
|
-
id: 5,
|
|
421
|
-
name: 'curr',
|
|
422
|
-
title: 'Current Page',
|
|
423
|
-
label: 'Current Page',
|
|
424
|
-
click: function (e) {
|
|
425
|
-
},
|
|
426
|
-
getDisabled: function () {
|
|
427
|
-
return grid._waitingRows || !grid.rows || grid.rows.length <= 1;
|
|
428
|
-
},
|
|
429
|
-
render: function (button, bottom) {
|
|
430
|
-
return (
|
|
431
|
-
<input
|
|
432
|
-
key={`pager_${bottom ? 'bottom' : 'top'}_${grid.id}_${button.id}_`}
|
|
433
|
-
title={grid.translate(button.title, 'grid-pager-button')}
|
|
434
|
-
value={grid.pageNumber}
|
|
435
|
-
grid-pager-item={`${grid.id}_${button.id}_`}
|
|
436
|
-
className={`${button.class ? button.class : grid.opt.inputClass || BaseComponent.theme.inputClass || 'grid-pager-current'}`}
|
|
437
|
-
style={{ width: '3em', height: '2em', display: 'inline-block', margin: '0 2px' }}
|
|
438
|
-
disabled={grid._waitingRows || grid.isEditing() || grid.isDisabled() ? 'disabled' : ''}
|
|
439
|
-
onChange={function (e) {
|
|
440
|
-
const newPage = +e.target.value;
|
|
441
|
-
|
|
442
|
-
if (grid.pageNumber !== newPage && newPage >= 1 && newPage <= grid.pagesCount) {
|
|
443
|
-
grid.pageNumber = newPage;
|
|
444
|
-
grid.selectedRowIndex = 0;
|
|
445
|
-
grid.refresh();
|
|
446
|
-
}
|
|
447
|
-
}}
|
|
448
|
-
>
|
|
449
|
-
</input>
|
|
450
|
-
)
|
|
451
|
-
},
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
grid.pagerButtons.push(curr);
|
|
455
|
-
grid.pagerButtonsDict[curr.id] = grid.pagerButtonsDict[curr.name] = curr;
|
|
456
|
-
|
|
457
|
-
const pages = {
|
|
458
|
-
id: 6,
|
|
459
|
-
name: 'pages',
|
|
460
|
-
title: 'Total Pages',
|
|
461
|
-
label: 'Total Pages',
|
|
462
|
-
render: function (button, bottom) {
|
|
463
|
-
return (
|
|
464
|
-
<span
|
|
465
|
-
key={`pager_${bottom ? 'bottom' : 'top'}_${grid.id}_${button.id}_`}
|
|
466
|
-
className={'grid-pager-of'}
|
|
467
|
-
title={grid.translate(button.title, 'grid-pager-button')}
|
|
468
|
-
>
|
|
469
|
-
{` ${grid.translate('of', 'pager-button')} ${grid.pagesCount >= 0 ? grid.pagesCount : '0'}`}
|
|
470
|
-
</span>
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
grid.pagerButtons.push(pages);
|
|
476
|
-
grid.pagerButtonsDict[pages.id] = grid.pagerButtonsDict[pages.name] = pages;
|
|
477
|
-
|
|
478
|
-
const next = {
|
|
479
|
-
id: 7,
|
|
480
|
-
name: 'next',
|
|
481
|
-
title: 'Next',
|
|
482
|
-
label: Images.images.next ? '' : 'Next',
|
|
483
|
-
click: function (e) {
|
|
484
|
-
grid.gotoNextPage();
|
|
485
|
-
},
|
|
486
|
-
getDisabled: function () {
|
|
487
|
-
return grid._waitingRows || !grid.rows || grid.rows.length <= 0 || grid.pageNumber === grid.pagesCount;
|
|
488
|
-
},
|
|
489
|
-
img: Images.images.next,
|
|
490
|
-
class: grid.pagerButtonsClass,
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
grid.pagerButtons.push(next);
|
|
494
|
-
grid.pagerButtonsDict[next.id] = grid.pagerButtonsDict[next.name] = next;
|
|
495
|
-
|
|
496
|
-
const last = {
|
|
497
|
-
id: 8,
|
|
498
|
-
name: 'last',
|
|
499
|
-
title: 'Last',
|
|
500
|
-
label: Images.images.last ? '' : 'Last',
|
|
501
|
-
click: function (e) {
|
|
502
|
-
grid.gotoLastPage();
|
|
503
|
-
},
|
|
504
|
-
getDisabled: function () {
|
|
505
|
-
return grid._waitingRows || !grid.rows || grid.rows.length <= 0 || grid.pageNumber === grid.pagesCount;
|
|
506
|
-
},
|
|
507
|
-
img: Images.images.last,
|
|
508
|
-
class: grid.pagerButtonsClass,
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
grid.pagerButtons.push(last);
|
|
512
|
-
grid.pagerButtonsDict[last.id] = grid.pagerButtonsDict[last.name] = last;
|
|
513
|
-
|
|
514
|
-
const pgsize = {
|
|
515
|
-
id: 9,
|
|
516
|
-
name: 'pgsize',
|
|
517
|
-
title: 'Page Size',
|
|
518
|
-
label: 'Page Size',
|
|
519
|
-
render: function (button, bottom) {
|
|
520
|
-
return (
|
|
521
|
-
<select
|
|
522
|
-
key={`pager_${bottom ? 'bottom' : 'top'}_${grid.id}_${button.id}_`}
|
|
523
|
-
title={grid.translate(button.title, 'grid-pager-button')}
|
|
524
|
-
grid-pager-item={`${grid.id}_${button.id}_`}
|
|
525
|
-
className={`grid-pager-size ${button.class ? button.class : grid.opt.inputClass || BaseComponent.theme.inputClass || ''}`}
|
|
526
|
-
style={{ width: '4.5em', height: '2em', display: 'inline-block', margin: '0 2px' }}
|
|
527
|
-
value={grid.pageSize}
|
|
528
|
-
disabled={grid._waitingRows || grid.isEditing() || grid.isDisabled() ? 'disabled' : ''}
|
|
529
|
-
onChange={function (e) {
|
|
530
|
-
grid.setPageSize(+e.target.value);
|
|
531
|
-
}}
|
|
532
|
-
>
|
|
533
|
-
{
|
|
534
|
-
grid.pageSizes.map((size, ind) => {
|
|
535
|
-
return (
|
|
536
|
-
<option
|
|
537
|
-
value={+size}
|
|
538
|
-
key={`pageSize_${grid.id}_${ind}_`}
|
|
539
|
-
>
|
|
540
|
-
{size}
|
|
541
|
-
</option>
|
|
542
|
-
);
|
|
543
|
-
})
|
|
544
|
-
}
|
|
545
|
-
</select>
|
|
546
|
-
);
|
|
547
|
-
},
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
grid.pagerButtons.push(pgsize);
|
|
551
|
-
grid.pagerButtonsDict[pgsize.id] = grid.pagerButtonsDict[pgsize.name] = pgsize;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
const rows = {
|
|
555
|
-
id: 10,
|
|
556
|
-
name: 'rows',
|
|
557
|
-
title: 'Total Rows',
|
|
558
|
-
label: 'Total Rows',
|
|
559
|
-
render: function (button, bottom) {
|
|
560
|
-
const total = `${grid.translate('total rows', 'pager-button')} ${grid.totalRows >= 0 ? grid.totalRows : '0'}`;
|
|
561
|
-
return (
|
|
562
|
-
<span
|
|
563
|
-
className={'grid-pager-total'}
|
|
564
|
-
title={total}
|
|
565
|
-
key={`pager_${bottom ? 'bottom' : 'top'}_${grid.id}_${button.id}_`}
|
|
566
|
-
style={{ margin: '5px 2px' }}
|
|
567
|
-
>
|
|
568
|
-
{total}
|
|
569
|
-
</span>
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
grid.pagerButtons.push(rows);
|
|
575
|
-
grid.pagerButtonsDict[rows.id] = grid.pagerButtonsDict[rows.name] = rows;
|
|
576
|
-
|
|
577
|
-
if (!grid.sortDisabled) {
|
|
578
|
-
const sort = {
|
|
579
|
-
id: 11,
|
|
580
|
-
name: 'sort',
|
|
581
|
-
title: 'Sort',
|
|
582
|
-
label: 'Sort',
|
|
583
|
-
render: function (button, bottom) {
|
|
584
|
-
return (
|
|
585
|
-
grid._sortString != null ?
|
|
586
|
-
<span
|
|
587
|
-
className={'grid-pager-total'}
|
|
588
|
-
title={grid._sortString}
|
|
589
|
-
key={`pager_${bottom ? 'bottom' : 'top'}_${grid.id}_${button.id}_`}
|
|
590
|
-
style={{ margin: '5px 2px' }}
|
|
591
|
-
>
|
|
592
|
-
{`${grid._sortString}`}
|
|
593
|
-
</span>
|
|
594
|
-
:
|
|
595
|
-
<></>
|
|
596
|
-
);
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
grid.pagerButtons.push(sort);
|
|
601
|
-
grid.pagerButtonsDict[sort.id] = grid.pagerButtonsDict[sort.name] = sort;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
605
|
-
setPageSize(newSize) {
|
|
606
|
-
const grid = this;
|
|
607
|
-
|
|
608
|
-
if (grid.pageSize === newSize || grid.pageSizes.indexOf(newSize) < 0) return;
|
|
609
|
-
|
|
610
|
-
grid.pageSize = newSize;
|
|
611
|
-
grid.pageNumber = 1;
|
|
612
|
-
grid.selectedRowIndex = 0;
|
|
613
|
-
grid.checkPocketState();
|
|
614
|
-
grid.refresh();
|
|
615
|
-
}
|
|
616
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
617
|
-
getHeaderGridTemplateColumns(col) {
|
|
618
|
-
return col.sortInd == null ? 'auto 12px' : 'auto 22px';
|
|
619
|
-
}
|
|
620
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
621
|
-
renderHeaderCell(col, context) {
|
|
622
|
-
const grid = this;
|
|
623
|
-
if (grid.sortDisabled) {
|
|
624
|
-
return super.renderHeaderCell(col, context);
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
const title = grid.translate(col.title || col.name) || '';
|
|
628
|
-
const sortDir = !col.sortable ? '' : col.asc ? '⯅' : col.desc ? '⯆' : '';
|
|
629
|
-
|
|
630
|
-
const parser = new DOMParser();
|
|
631
|
-
const decodedString = parser.parseFromString(`<!doctype html><body>${sortDir}`, 'text/html').body.textContent;
|
|
632
|
-
|
|
633
|
-
const notDisabled = !grid._waitingRows && !grid.isEditing() && !grid.isDisabled();
|
|
634
|
-
|
|
635
|
-
return (
|
|
636
|
-
<>
|
|
637
|
-
<span
|
|
638
|
-
className={`grid-header-title ${col.sortable ? 'grid-header-title-sortable' : ''}`}
|
|
639
|
-
style={{
|
|
640
|
-
cursor: col.sortable && notDisabled ? 'pointer' : '',
|
|
641
|
-
gridColumn: !sortDir ? 'span 2' : '', opacity: notDisabled ? "1" : "0.6",
|
|
642
|
-
whiteSpace: 'nowrap',
|
|
643
|
-
overflowX: 'hidden',
|
|
644
|
-
width: sortDir ? 'calc(100% - 10px)' : '',
|
|
645
|
-
textAlign: 'left',
|
|
646
|
-
}}
|
|
647
|
-
onClick={(e) => { if (!grid._waitingRows) grid.changeColumnSortOrder(col, e); }}
|
|
648
|
-
disabled={grid._waitingRows || col.disabled ? 'disabled' : ''}
|
|
649
|
-
>
|
|
650
|
-
{title}
|
|
651
|
-
</span>
|
|
652
|
-
{sortDir ? <span className={'grid-header-sort-sign'} style={{ opacity: notDisabled ? "1" : "0.6" }}>{decodedString + (col.sortInd > 0 ? ` ${col.sortInd} ` : '')}</span> : ''}
|
|
653
|
-
</>
|
|
654
|
-
);
|
|
655
|
-
}
|
|
656
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
657
|
-
getGridSettingsList() {
|
|
658
|
-
const grid = this;
|
|
659
|
-
const res = [
|
|
660
|
-
{ id: 0, text: grid.translate('Reset columns order', 'grid-menu') },
|
|
661
|
-
{ id: 1, text: grid.translate('Reset columns widths', 'grid-menu') },
|
|
662
|
-
];
|
|
663
|
-
|
|
664
|
-
if (!grid.sortDisabled) {
|
|
665
|
-
res.push({ id: 2, text: grid.translate('Reset columns sort', 'grid-menu') });
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
return res;
|
|
669
|
-
}
|
|
670
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
671
|
-
getGridSettings(e) {
|
|
672
|
-
const grid = this;
|
|
673
|
-
return new Promise(function (resolve, reject) {
|
|
674
|
-
|
|
675
|
-
const items = grid.getGridSettingsList();
|
|
676
|
-
resolve(items);
|
|
677
|
-
});
|
|
678
|
-
}
|
|
679
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
680
|
-
showGridSettings(e) {
|
|
681
|
-
const grid = this;
|
|
682
|
-
|
|
683
|
-
if (!grid.menuDropdown) return;
|
|
684
|
-
|
|
685
|
-
const elem = document.getElementById(e.target.id);
|
|
686
|
-
grid.menuDropdown.opt.parentRect = elem ? elem.getBoundingClientRect() : e.target.getBoundingClientRect();
|
|
687
|
-
|
|
688
|
-
grid.menuDropdown.popup(e);
|
|
689
|
-
}
|
|
690
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
691
|
-
checkPocketState() {
|
|
692
|
-
super.checkPocketState();
|
|
693
|
-
|
|
694
|
-
const grid = this;
|
|
695
|
-
if (!grid.multi) return;
|
|
696
|
-
|
|
697
|
-
grid.setPocketImage();
|
|
698
|
-
}
|
|
699
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
700
|
-
setPocketImage() {
|
|
701
|
-
const grid = this;
|
|
702
|
-
if (!grid.multi || !grid.pagerButtonsDict) return;
|
|
703
|
-
|
|
704
|
-
const pocket = grid.pagerButtonsDict['pocket'];
|
|
705
|
-
if (!pocket) return;
|
|
706
|
-
|
|
707
|
-
pocket.img = grid.pocketOpened ? Images.images.pocketOpened : Images.images.pocket;
|
|
708
|
-
}
|
|
709
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
710
|
-
switchGridPocket(e) {
|
|
711
|
-
const grid = this;
|
|
712
|
-
if (!grid.multi) return;
|
|
713
|
-
|
|
714
|
-
grid.pocketOpened = !grid.pocketOpened;
|
|
715
|
-
|
|
716
|
-
grid.setPocketImage();
|
|
717
|
-
grid.refreshState();
|
|
718
|
-
|
|
719
|
-
if (grid.graph) {
|
|
720
|
-
grid.graph.triggerWave({ nodes: [grid], withStartNodes: false });
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
724
|
-
loadPocketRows() {
|
|
725
|
-
const grid = this;
|
|
726
|
-
super.loadPocketRows();
|
|
727
|
-
|
|
728
|
-
grid._sortColumns = [];
|
|
729
|
-
for (let col of grid.columns) {
|
|
730
|
-
if (col.sortInd != null && col.sortInd !== null || col.asc || col.desc) {
|
|
731
|
-
grid._sortColumns.push(col);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
if (grid._sortColumns.length > 0) {
|
|
736
|
-
grid._sortColumns.sort((a, b) => { return a.sortInd > b.sortInd ? 1 : -1 });
|
|
737
|
-
}
|
|
738
|
-
else {
|
|
739
|
-
grid._sortColumns.push({ name: grid.getKeyColumn(), asc: true });
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
//let sortCol = null;
|
|
743
|
-
//for (let col of grid.columns) {
|
|
744
|
-
// if (col.asc || col.desc) {
|
|
745
|
-
// sortCol = col;
|
|
746
|
-
// break;
|
|
747
|
-
// }
|
|
748
|
-
//}
|
|
749
|
-
|
|
750
|
-
//if (sortCol != null) {
|
|
751
|
-
// this._selectedRows.sort(function (a, b) { return a[sortCol.name] > b[sortCol.name] ? (sortCol.asc ? 1 : -1) : (sortCol.asc ? -1 : 1); });
|
|
752
|
-
//}
|
|
753
|
-
|
|
754
|
-
grid._selectedRows.sort((a, b) => {
|
|
755
|
-
let lastCol;
|
|
756
|
-
for (let col of grid._sortColumns) {
|
|
757
|
-
if (a[col.name] === b[col.name]) continue;
|
|
758
|
-
lastCol = col;
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
if (!lastCol) return 0;
|
|
762
|
-
return a[lastCol.name] > b[lastCol.name] ? (lastCol.asc ? 1 : -1) : (lastCol.asc ? -1 : 1);
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
766
|
-
onSettingsItemClick(itemId) {
|
|
767
|
-
const grid = this;
|
|
768
|
-
|
|
769
|
-
switch (String(itemId)) {
|
|
770
|
-
case '0':
|
|
771
|
-
grid.resetColumnsOrderToDefault();
|
|
772
|
-
break;
|
|
773
|
-
case '1':
|
|
774
|
-
grid.resetColumnsWidthsToDefault();
|
|
775
|
-
break;
|
|
776
|
-
case '2':
|
|
777
|
-
grid.resetColumnsSort();
|
|
778
|
-
break;
|
|
779
|
-
default:
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
783
|
-
resetColumnsSort() {
|
|
784
|
-
const grid = this;
|
|
785
|
-
grid._sortString = '';
|
|
786
|
-
let needRefresh = false;
|
|
787
|
-
for (let col of grid.columns) {
|
|
788
|
-
needRefresh = needRefresh || col.asc != false || col.desc != false;
|
|
789
|
-
|
|
790
|
-
delete col.asc;
|
|
791
|
-
delete col.desc;
|
|
792
|
-
delete col.sortInd;
|
|
793
|
-
}
|
|
794
|
-
if (needRefresh) {
|
|
795
|
-
grid.refresh();
|
|
796
|
-
}
|
|
797
|
-
else {
|
|
798
|
-
grid.refreshState();
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
802
|
-
changeColumnSortOrder(column, e) {
|
|
803
|
-
const grid = this;
|
|
804
|
-
|
|
805
|
-
if (column === grid._skipClickColumn) {
|
|
806
|
-
delete grid._skipClickColumn;
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
if (!column.sortable || grid.isEditing() || grid.isDisabled()) return;
|
|
811
|
-
|
|
812
|
-
let nextInd = 1;
|
|
813
|
-
if (e.shiftKey) {
|
|
814
|
-
for (let col of grid.columns) {
|
|
815
|
-
if (col.sortInd != null && col.sortInd !== null) {
|
|
816
|
-
nextInd++;
|
|
817
|
-
}
|
|
818
|
-
else if (col.asc || col.desc) {
|
|
819
|
-
col.sortInd = nextInd++;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
if (column.asc) {
|
|
825
|
-
delete column.asc;
|
|
826
|
-
column.desc = true;
|
|
827
|
-
if (!e.shiftKey) {
|
|
828
|
-
delete column.sortInd;
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
else if (column.desc) {
|
|
832
|
-
const prevInd = column.sortInd;
|
|
833
|
-
delete column.desc;
|
|
834
|
-
delete column.sortInd;
|
|
835
|
-
if (e.shiftKey) {
|
|
836
|
-
for (let col of grid.columns) {
|
|
837
|
-
if (col.sortInd > prevInd) col.sortInd--;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
else {
|
|
842
|
-
column.asc = true;
|
|
843
|
-
if (e.shiftKey) {
|
|
844
|
-
column.sortInd = nextInd;
|
|
845
|
-
}
|
|
846
|
-
else {
|
|
847
|
-
delete column.sortInd;
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
if (!e.shiftKey) {
|
|
852
|
-
for (let col of grid.columns) {
|
|
853
|
-
if (col === column) continue;
|
|
854
|
-
|
|
855
|
-
delete col.asc;
|
|
856
|
-
delete col.desc;
|
|
857
|
-
delete col.sortInd;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
delete grid._sortString;
|
|
862
|
-
grid.selectedRowIndex = 0;
|
|
863
|
-
grid.afterSortColumn(column);
|
|
864
|
-
grid.refresh();
|
|
865
|
-
}
|
|
866
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
867
|
-
afterSortColumn(column) {
|
|
868
|
-
const grid = this;
|
|
869
|
-
grid.getSortedString();
|
|
870
|
-
delete grid._selectedRows;
|
|
871
|
-
}
|
|
872
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
873
|
-
getSortedString() {
|
|
874
|
-
const grid = this;
|
|
875
|
-
//if (grid._sortString != null) return grid._sortString;
|
|
876
|
-
|
|
877
|
-
grid._sortString = '';
|
|
878
|
-
if (grid.sortDisabled) return '';
|
|
879
|
-
|
|
880
|
-
const sortedColumns = [];
|
|
881
|
-
for (let col of grid.columns) {
|
|
882
|
-
if (col.asc || col.desc) sortedColumns.push(col);
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
sortedColumns.sort((a, b) => { return a.sortInd > b.sortInd ? 1 : -1 });
|
|
886
|
-
|
|
887
|
-
const arr = [];
|
|
888
|
-
for (let col of sortedColumns) {
|
|
889
|
-
arr.push((col.title || col.name) + (col.desc ? ' (' + grid.translate('desc') + ')' : ''));
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
grid._sortString = arr.join(', ');
|
|
893
|
-
|
|
894
|
-
grid._sortString = grid._sortString ? grid.translate('sort', 'pager-button') + ': ' + grid._sortString : '';
|
|
895
|
-
}
|
|
896
|
-
// -------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
897
|
-
}
|