@refinitiv-ui/efx-grid 6.0.91 → 6.0.93
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/column-dragging/es6/ColumnDragging.d.ts +1 -1
- package/lib/column-dragging/es6/ColumnDragging.js +144 -34
- package/lib/core/dist/core.js +2410 -2621
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.js +14 -14
- package/lib/core/es6/data/DataCache.js +118 -118
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +208 -190
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +291 -291
- package/lib/core/es6/data/Segment.js +79 -79
- package/lib/core/es6/data/SegmentCollection.js +81 -81
- package/lib/core/es6/data/WrappedView.js +41 -41
- package/lib/core/es6/grid/Core.js +635 -635
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.js +183 -183
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
- package/lib/core/es6/grid/components/Cell.js +29 -29
- package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
- package/lib/core/es6/grid/components/CellSpan.js +7 -7
- package/lib/core/es6/grid/components/CellSpans.js +36 -34
- package/lib/core/es6/grid/components/Column.js +40 -40
- package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
- package/lib/core/es6/grid/components/HScrollbar.js +31 -31
- package/lib/core/es6/grid/components/Scrollbar.js +77 -77
- package/lib/core/es6/grid/components/StretchedCells.js +49 -49
- package/lib/core/es6/grid/components/VScrollbar.js +11 -11
- package/lib/core/es6/grid/components/VirtualItems.js +3 -3
- package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
- package/lib/core/es6/grid/event/EventListeners.js +4 -4
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
- package/lib/core/es6/grid/util/Conflator.js +4 -4
- package/lib/core/es6/grid/util/Reverter.js +1 -1
- package/lib/core/es6/grid/util/SectionSettings.js +20 -20
- package/lib/core/es6/grid/util/SelectionList.js +23 -23
- package/lib/core/es6/grid/util/TrackLayout.js +74 -74
- package/lib/core/es6/grid/util/Virtualizer.js +15 -15
- package/lib/core/es6/grid/util/util.js +20 -20
- package/lib/core/es6/index.d.ts +0 -2
- package/lib/core/es6/index.js +0 -3
- package/lib/filter-dialog/lib/filter-dialog.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +193 -70
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +46 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
- package/lib/rt-grid/es6/RowDefinition.js +74 -16
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +268 -268
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -32
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
- package/lib/tr-grid-util/es6/CellPainter.js +94 -104
- package/lib/tr-grid-util/es6/Conflator.js +4 -4
- package/lib/tr-grid-util/es6/CoralItems.js +6 -6
- package/lib/tr-grid-util/es6/DateTime.js +41 -41
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
- package/lib/tr-grid-util/es6/Delay.js +14 -3
- package/lib/tr-grid-util/es6/Dom.js +26 -26
- package/lib/tr-grid-util/es6/DragUI.js +17 -17
- package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
- package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
- package/lib/tr-grid-util/es6/ElfDate.js +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
- package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
- package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
- package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
- package/lib/tr-grid-util/es6/Ext.js +6 -6
- package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
- package/lib/tr-grid-util/es6/FilterBuilder.js +57 -58
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +86 -87
- package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
- package/lib/tr-grid-util/es6/Icon.js +4 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
- package/lib/tr-grid-util/es6/MultiTableManager.js +71 -80
- package/lib/tr-grid-util/es6/NumberFormatter.js +23 -23
- package/lib/tr-grid-util/es6/PercentBar.js +17 -17
- package/lib/tr-grid-util/es6/Perf.js +5 -5
- package/lib/tr-grid-util/es6/Popup.js +42 -42
- package/lib/tr-grid-util/es6/RangeBar.js +5 -5
- package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
- package/lib/tr-grid-util/es6/RowPainter.js +23 -23
- package/lib/tr-grid-util/es6/SubTable.js +94 -94
- package/lib/tr-grid-util/es6/Table.js +51 -51
- package/lib/tr-grid-util/es6/TextHighlighter.js +52 -52
- package/lib/tr-grid-util/es6/TickCodes.js +2 -2
- package/lib/tr-grid-util/es6/Timer.js +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
- package/lib/tr-grid-util/es6/Util.js +50 -50
- package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
- package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
- package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
- package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
- package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
- package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
- package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
- package/lib/tr-grid-util/es6/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
- package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
- package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
- package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
- package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
- package/lib/tr-grid-util/es6/jet/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
- package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation.js +1 -1
- package/lib/types/es6/ColumnDragging.d.ts +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +3 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
- package/lib/types/es6/RowDragging.d.ts +1 -2
- package/lib/versions.json +12 -12
- package/package.json +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
- package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
- package/lib/core/es6/grid/util/HttpRequest.js +0 -371
- package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
- package/lib/core/es6/grid/util/PercentBar.js +0 -390
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
- package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
- package/lib/core/es6/grid/util/RangeBar.js +0 -255
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
|
@@ -57,8 +57,8 @@ import { Conflator } from "../../../tr-grid-util/es6/Conflator.js";
|
|
|
57
57
|
* @param {DataTable|DataView=} source
|
|
58
58
|
* @see {@link DataTable}
|
|
59
59
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
let DataView = function(source) {
|
|
61
|
+
let t = this; // For file minification
|
|
62
62
|
t._groupFilterLogic = t._groupFilterLogic.bind(t);
|
|
63
63
|
t._internalGroupSortingLogic = t._internalGroupSortingLogic.bind(t);
|
|
64
64
|
|
|
@@ -331,7 +331,7 @@ DataView.prototype.dispose = function() {
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
if(this._columnStats) {
|
|
334
|
-
for(
|
|
334
|
+
for(let field in this._columnStats) {
|
|
335
335
|
this._columnStats[field].dispose();
|
|
336
336
|
}
|
|
337
337
|
this._columnStats = null;
|
|
@@ -361,12 +361,12 @@ DataView.prototype.getRowData = function(rid) {
|
|
|
361
361
|
* @return {!Array}
|
|
362
362
|
*/
|
|
363
363
|
DataView.prototype.getColumnData = function(cid, inclNonDataRow) {
|
|
364
|
-
|
|
364
|
+
let rids = this.getAllRowIds(true, inclNonDataRow);
|
|
365
365
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
for(
|
|
369
|
-
|
|
366
|
+
let rows = [];
|
|
367
|
+
let len = rids.length;
|
|
368
|
+
for(let r = 0; r < len; ++r) {
|
|
369
|
+
let rowData = this._dt.getRowData(rids[r]);
|
|
370
370
|
if(rowData) {
|
|
371
371
|
rows.push(rowData[cid]);
|
|
372
372
|
} else if(inclNonDataRow) {
|
|
@@ -401,11 +401,11 @@ DataView.prototype._toRowId = function(rowRef) {
|
|
|
401
401
|
* @return {!Array.<string>}
|
|
402
402
|
*/
|
|
403
403
|
DataView.prototype._toRowIds = function(rowRefs) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
for(
|
|
408
|
-
|
|
404
|
+
let rowCount = Array.isArray(rowRefs) ? rowRefs.length : 0;
|
|
405
|
+
let ary = new Array(rowCount);
|
|
406
|
+
let rids = this._getRids();
|
|
407
|
+
for(let r = 0; r < rowCount; ++r) {
|
|
408
|
+
let rowRef = rowRefs[r];
|
|
409
409
|
if(typeof rowRef === "number") {
|
|
410
410
|
this._rebuildRowIdsFromChildren();
|
|
411
411
|
ary[r] = rids[rowRef] || "";
|
|
@@ -429,7 +429,7 @@ DataView.prototype.getAllRowIds = function(shallowCopy, inclNonDataRow) {
|
|
|
429
429
|
this._rebuildRowIdsFromChildren();
|
|
430
430
|
|
|
431
431
|
// WARNING: this._pageView can contain non-data rows (group header rows), even if inclNonDataRow flag is false
|
|
432
|
-
|
|
432
|
+
let rids = (inclNonDataRow) ? this._getRids() : (this._pageView || this._rids);
|
|
433
433
|
|
|
434
434
|
return (shallowCopy) ? rids : rids.slice(0); // Fastest way to clone an array is Array.slice()
|
|
435
435
|
};
|
|
@@ -441,7 +441,7 @@ DataView.prototype.getAllRowIds = function(shallowCopy, inclNonDataRow) {
|
|
|
441
441
|
*/
|
|
442
442
|
DataView.prototype.getVisibleRowIds = function(shallowCopy) {
|
|
443
443
|
this._rebuildRowIdsFromChildren();
|
|
444
|
-
|
|
444
|
+
let rids = this._getRids();
|
|
445
445
|
return shallowCopy ? rids : rids.slice(0); // Fastest way to clone an array
|
|
446
446
|
};
|
|
447
447
|
/** Return all data rows that is filtered and sorted, excluding header rows or paging. This method ignores pagination.
|
|
@@ -561,7 +561,7 @@ DataView.prototype.setColumnData = function(cid, valueList, opt_ridList) {
|
|
|
561
561
|
* @fires DataView#dataChanged
|
|
562
562
|
*/
|
|
563
563
|
DataView.prototype.setDataAt = function(rowIndex, cid, value) {
|
|
564
|
-
|
|
564
|
+
let rid = this.getRowId(rowIndex);
|
|
565
565
|
if(rid && this._dt) {
|
|
566
566
|
return this._dt.setData(rid, cid, value);
|
|
567
567
|
}
|
|
@@ -576,7 +576,7 @@ DataView.prototype.setDataAt = function(rowIndex, cid, value) {
|
|
|
576
576
|
* @fires DataView#dataChanged
|
|
577
577
|
*/
|
|
578
578
|
DataView.prototype.setRowDataAt = function(rowIndex, values, opt_eventArg) {
|
|
579
|
-
|
|
579
|
+
let rid = this.getRowId(rowIndex);
|
|
580
580
|
return this.setRowData(rid, values, opt_eventArg);
|
|
581
581
|
};
|
|
582
582
|
|
|
@@ -588,7 +588,7 @@ DataView.prototype.setRowDataAt = function(rowIndex, values, opt_eventArg) {
|
|
|
588
588
|
*/
|
|
589
589
|
DataView.prototype.insertRow = function(rowRef, opt_values, opt_rid) { // Data changed event may be dispatched
|
|
590
590
|
this._rebuildRowIdsFromChildren(); // TODO: Check if we need to rebuild row ids
|
|
591
|
-
|
|
591
|
+
let nextRid = this._toRowId(rowRef);
|
|
592
592
|
|
|
593
593
|
if(this._dt) {
|
|
594
594
|
return this._dt.insertRow(nextRid, opt_values, opt_rid);
|
|
@@ -626,10 +626,10 @@ DataView.prototype.removeRows = function(rowRefs) {
|
|
|
626
626
|
* move(ary, 1, 0); // [1, 0, 2] Move index 1 to the position before index 0
|
|
627
627
|
*/
|
|
628
628
|
DataView.prototype.moveRow = function(fromRef, toRef) {
|
|
629
|
-
|
|
629
|
+
let toRid = this._toRowId(toRef);
|
|
630
630
|
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
let fromIndices = /** @type{!Array.<number|string>} */(Array.isArray(fromRef) ? fromRef : [fromRef]);
|
|
632
|
+
let fromRids = this._toRowIds(fromIndices);
|
|
633
633
|
|
|
634
634
|
if(this._dt.hasSegmentation()) {
|
|
635
635
|
this.synchronizeRowOrder();
|
|
@@ -731,14 +731,14 @@ DataView.prototype.sort = function (cid, opt_sortOrder, sortLogics, noOptimizati
|
|
|
731
731
|
return;
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
734
|
+
let compMap = this.getSortingLogics();
|
|
735
|
+
let sortingDefs = this._sortingDefs;
|
|
736
|
+
let curSortLen = sortingDefs.length;
|
|
737
737
|
|
|
738
738
|
if (Array.isArray(sortLogics)) {
|
|
739
|
-
for(
|
|
739
|
+
for(let c = sortLogics.length; --c >= 0;) {
|
|
740
740
|
if (typeof sortLogics[c] !== "function") {
|
|
741
|
-
|
|
741
|
+
let columnId = Array.isArray(cid) ? cid[c] : cid;
|
|
742
742
|
sortLogics[c] = compMap[columnId] || compMap["_default"];
|
|
743
743
|
}
|
|
744
744
|
}
|
|
@@ -759,7 +759,7 @@ DataView.prototype.sort = function (cid, opt_sortOrder, sortLogics, noOptimizati
|
|
|
759
759
|
return;
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
-
|
|
762
|
+
let change = false;
|
|
763
763
|
|
|
764
764
|
if (this._groupMembers || sortingDefs.length <= 0 || noOptimization) {
|
|
765
765
|
change = true;
|
|
@@ -786,8 +786,8 @@ DataView.prototype.sortOnce = function(cid, opt_sortOrder) {
|
|
|
786
786
|
* customLogic = function(a, b, sortOrder) {
|
|
787
787
|
* return (a - b) * sortOrder; // for numeric comparison
|
|
788
788
|
* };
|
|
789
|
-
*
|
|
790
|
-
*
|
|
789
|
+
* let dt = new DataTable();
|
|
790
|
+
* let dv = new DataView(dt);
|
|
791
791
|
* dv.setSortingLogic(customLogic);
|
|
792
792
|
* dv.sort("Column id", "ascending");
|
|
793
793
|
*/
|
|
@@ -840,7 +840,7 @@ DataView.prototype.hideRow = function(rId, hidden) {
|
|
|
840
840
|
*/
|
|
841
841
|
DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
842
842
|
hidden = hidden !== false;
|
|
843
|
-
|
|
843
|
+
let hiddenRids = this._hiddenRids;
|
|
844
844
|
|
|
845
845
|
if(hidden){
|
|
846
846
|
if(!hiddenRids) {
|
|
@@ -850,11 +850,11 @@ DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
|
850
850
|
return; // All rows are visible
|
|
851
851
|
}
|
|
852
852
|
|
|
853
|
-
|
|
854
|
-
|
|
853
|
+
let rids = this._toRowIds(rowRefs);
|
|
854
|
+
let dirty = false;
|
|
855
855
|
|
|
856
|
-
for(
|
|
857
|
-
|
|
856
|
+
for(let i = rids.length; --i >= 0;) {
|
|
857
|
+
let rid = rids[i];
|
|
858
858
|
if(rid) { // undefined, null, and an empty string value are not a valid row id
|
|
859
859
|
if(hidden) {
|
|
860
860
|
if(!hiddenRids[rid]) {
|
|
@@ -870,8 +870,8 @@ DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
|
870
870
|
|
|
871
871
|
if(dirty) {
|
|
872
872
|
if(!hidden) {
|
|
873
|
-
|
|
874
|
-
for(
|
|
873
|
+
let hasHiddenRow = false;
|
|
874
|
+
for(let key in hiddenRids) { // eslint-disable-line
|
|
875
875
|
hasHiddenRow = true;
|
|
876
876
|
break;
|
|
877
877
|
}
|
|
@@ -924,8 +924,8 @@ DataView.prototype.hasHiddenRow = function(){
|
|
|
924
924
|
* });
|
|
925
925
|
*/
|
|
926
926
|
DataView.prototype.filterIn = function(cid, value, opt_filteringOut) {
|
|
927
|
-
|
|
928
|
-
|
|
927
|
+
let newLogic = this._getFilterLogic(cid, value);
|
|
928
|
+
let filteringOut = (opt_filteringOut === true);
|
|
929
929
|
if(this._userFilter === newLogic && typeof cid !== "function") {
|
|
930
930
|
if(!newLogic || filteringOut === this._filteringOut) {
|
|
931
931
|
return false; // Nothing to update
|
|
@@ -962,8 +962,8 @@ DataView.prototype.filterOut = function(cid, value) {
|
|
|
962
962
|
* @fires DataView#dataChanged
|
|
963
963
|
*/
|
|
964
964
|
DataView.prototype.filterInOnce = function(cid, value, opt_filteringOut) {
|
|
965
|
-
|
|
966
|
-
|
|
965
|
+
let checker = this._getFilterLogic(cid, value);
|
|
966
|
+
let removalMap = {};
|
|
967
967
|
if(!this._getRemovalMap(
|
|
968
968
|
removalMap,
|
|
969
969
|
checker,
|
|
@@ -972,9 +972,9 @@ DataView.prototype.filterInOnce = function(cid, value, opt_filteringOut) {
|
|
|
972
972
|
return;
|
|
973
973
|
}
|
|
974
974
|
|
|
975
|
-
|
|
975
|
+
let firstChange = this._removeRowIds(removalMap);
|
|
976
976
|
|
|
977
|
-
|
|
977
|
+
let pageIndexChanged = this._updatePageCount();
|
|
978
978
|
if(pageIndexChanged || this._transformView(firstChange)) {
|
|
979
979
|
this._dispatchGlobalChange();
|
|
980
980
|
} else {
|
|
@@ -997,15 +997,15 @@ DataView.prototype.filterOutOnce = function(cid, value) {
|
|
|
997
997
|
* @return {number}
|
|
998
998
|
*/
|
|
999
999
|
DataView.prototype._removeRowIds = function(removalMap) {
|
|
1000
|
-
|
|
1000
|
+
let firstChange = DataView._removeArrayItems(this._rids, removalMap);
|
|
1001
1001
|
if(this._groupView) {
|
|
1002
1002
|
firstChange = DataView._removeArrayItems(this._groupView, removalMap);
|
|
1003
1003
|
}
|
|
1004
1004
|
|
|
1005
1005
|
if(this._groupMembers) {
|
|
1006
|
-
|
|
1007
|
-
for(
|
|
1008
|
-
|
|
1006
|
+
let len = this._groupList.length;
|
|
1007
|
+
for(let i = 0; i < len; ++i) {
|
|
1008
|
+
let groupId = this._groupList[i];
|
|
1009
1009
|
this._groupMembers[groupId]._removeRowIds(removalMap);
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
@@ -1040,7 +1040,7 @@ DataView.prototype.disablePageCorrection = function(opt_disable) {
|
|
|
1040
1040
|
* @fires DataView#dataChanged
|
|
1041
1041
|
*/
|
|
1042
1042
|
DataView.prototype.setPage = function (pageIndex) {
|
|
1043
|
-
|
|
1043
|
+
let result = this._setPage(pageIndex);
|
|
1044
1044
|
if(result) {
|
|
1045
1045
|
this._dispatchGlobalChange();
|
|
1046
1046
|
}
|
|
@@ -1190,7 +1190,7 @@ DataView.prototype.groupBy = function (cid, opt_predefinedGroups) {
|
|
|
1190
1190
|
|
|
1191
1191
|
if(this._groupCriteria) {
|
|
1192
1192
|
if(this._groupList && this._groupList.length > 0) { // Dispose any existing member
|
|
1193
|
-
for(
|
|
1193
|
+
for(let key in this._groupMembers) {
|
|
1194
1194
|
this._groupMembers[key].dispose(); // Clear everything in the data view
|
|
1195
1195
|
}
|
|
1196
1196
|
this._groupMembers = {}; // Clear all members
|
|
@@ -1202,10 +1202,10 @@ DataView.prototype.groupBy = function (cid, opt_predefinedGroups) {
|
|
|
1202
1202
|
this._setPredefinedGroups(opt_predefinedGroups);
|
|
1203
1203
|
}
|
|
1204
1204
|
|
|
1205
|
-
|
|
1205
|
+
let i, len;
|
|
1206
1206
|
if(cid && this._groupLevel === 0) { // Sub group cannot be re-group without its parent noticing it
|
|
1207
1207
|
this._groupCriteria = [];
|
|
1208
|
-
|
|
1208
|
+
let ary;
|
|
1209
1209
|
if(!Array.isArray(cid)) {
|
|
1210
1210
|
ary = [cid];
|
|
1211
1211
|
} else {
|
|
@@ -1213,7 +1213,7 @@ DataView.prototype.groupBy = function (cid, opt_predefinedGroups) {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
len = ary.length;
|
|
1215
1215
|
for(i = 0; i < len; ++i) {
|
|
1216
|
-
|
|
1216
|
+
let criteria = ary[i];
|
|
1217
1217
|
if(typeof criteria === "string") {
|
|
1218
1218
|
this._groupCriteria.push(this._defaultGroupCriteria.bind(this, criteria));
|
|
1219
1219
|
} else if(criteria) {
|
|
@@ -1276,9 +1276,9 @@ DataView.prototype.addGroup = function (value) {
|
|
|
1276
1276
|
if(!isArray(value)) {
|
|
1277
1277
|
this._addGroup(value);
|
|
1278
1278
|
} else {
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
for(
|
|
1279
|
+
let ary = /** @type{Array} */(value);
|
|
1280
|
+
let len = ary.length;
|
|
1281
|
+
for(let i = 0; i < len; ++i) {
|
|
1282
1282
|
this._addGroup(ary[i]);
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
@@ -1300,8 +1300,8 @@ DataView.prototype.sortGroups = function (compare) {
|
|
|
1300
1300
|
}
|
|
1301
1301
|
|
|
1302
1302
|
this._groupList.sort(this._internalGroupSortingLogic);
|
|
1303
|
-
for(
|
|
1304
|
-
|
|
1303
|
+
for(let i = this._groupList.length; --i >= 0;){
|
|
1304
|
+
let groupId = this._groupList[i];
|
|
1305
1305
|
this._groupMembers[groupId].sortGroups(this._groupSortingLogic);
|
|
1306
1306
|
}
|
|
1307
1307
|
this._groupViewDirty = true;
|
|
@@ -1315,14 +1315,14 @@ DataView.prototype.sortGroups = function (compare) {
|
|
|
1315
1315
|
* @param {number} destIndex
|
|
1316
1316
|
*/
|
|
1317
1317
|
DataView.prototype.moveGroup = function (groupRef, destIndex) {
|
|
1318
|
-
|
|
1318
|
+
let movedGroup = this.getGroup(groupRef);
|
|
1319
1319
|
if(!movedGroup) {
|
|
1320
1320
|
return; // Cannot find the given group
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1323
|
+
let parentGroup = movedGroup.getDataSource();
|
|
1324
|
+
let groupId = movedGroup.getGroupId();
|
|
1325
|
+
let curGroupIndex = parentGroup._groupList.indexOf(groupId);
|
|
1326
1326
|
if(curGroupIndex === destIndex || curGroupIndex + 1 === destIndex) {
|
|
1327
1327
|
return; // Nothing is needed to be moved
|
|
1328
1328
|
}
|
|
@@ -1360,11 +1360,11 @@ DataView.prototype._setPredefinedGroups = function (predefinedGroups) {
|
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
1362
1362
|
if(this._preDefGroups) {
|
|
1363
|
-
this._preDefGroups.length = 0; // Remove all predefined groups in all members (this
|
|
1363
|
+
this._preDefGroups.length = 0; // Remove all predefined groups in all members (this let is shared)
|
|
1364
1364
|
}
|
|
1365
|
-
|
|
1365
|
+
let is2D = false;
|
|
1366
1366
|
if(predefinedGroups) {
|
|
1367
|
-
for(
|
|
1367
|
+
for(let i = predefinedGroups.length; --i >= 0;) {
|
|
1368
1368
|
if(Array.isArray(predefinedGroups[i])) {
|
|
1369
1369
|
is2D = true;
|
|
1370
1370
|
break;
|
|
@@ -1402,8 +1402,8 @@ DataView.prototype.addFooter = function (opt_num) {
|
|
|
1402
1402
|
this._footerRowIds = [];
|
|
1403
1403
|
}
|
|
1404
1404
|
|
|
1405
|
-
for(
|
|
1406
|
-
|
|
1405
|
+
for(let i = 0; i < opt_num; ++i) {
|
|
1406
|
+
let footerRowId = this._groupRowId + "_footer" + (this._footerRowIds.length || "");
|
|
1407
1407
|
this._footerRowIds.push(footerRowId);
|
|
1408
1408
|
this._groupRows[footerRowId] = this;
|
|
1409
1409
|
}
|
|
@@ -1417,8 +1417,8 @@ DataView.prototype.addFooter = function (opt_num) {
|
|
|
1417
1417
|
*/
|
|
1418
1418
|
DataView.prototype.removeFooter = function () {
|
|
1419
1419
|
if(this._footerRowIds) {
|
|
1420
|
-
|
|
1421
|
-
for(
|
|
1420
|
+
let len = this._footerRowIds.length;
|
|
1421
|
+
for(let i = 0; i < len; ++i) {
|
|
1422
1422
|
delete this._groupRows[this._footerRowIds[i]];
|
|
1423
1423
|
}
|
|
1424
1424
|
this._footerRowIds = null;
|
|
@@ -1462,7 +1462,7 @@ DataView.prototype.getGroup = function (groupRef) {
|
|
|
1462
1462
|
if(!this._groupMembers) {
|
|
1463
1463
|
return null;
|
|
1464
1464
|
}
|
|
1465
|
-
|
|
1465
|
+
let groupId;
|
|
1466
1466
|
if(typeof groupRef === "number") {
|
|
1467
1467
|
groupId = this._groupList[groupRef];
|
|
1468
1468
|
if(!groupId) {
|
|
@@ -1473,13 +1473,13 @@ DataView.prototype.getGroup = function (groupRef) {
|
|
|
1473
1473
|
}
|
|
1474
1474
|
|
|
1475
1475
|
// Search immediate child groups by group Id
|
|
1476
|
-
|
|
1476
|
+
let dv = this._groupMembers[groupId];
|
|
1477
1477
|
if(dv) {
|
|
1478
1478
|
return dv;
|
|
1479
1479
|
}
|
|
1480
1480
|
|
|
1481
1481
|
// A group cannot be found by group Id. It is now assumed to be row id
|
|
1482
|
-
|
|
1482
|
+
let rowId = groupId;
|
|
1483
1483
|
dv = this._groupRows[rowId]; // Groups of any level will be searched
|
|
1484
1484
|
if(dv) {
|
|
1485
1485
|
return dv;
|
|
@@ -1495,10 +1495,10 @@ DataView.prototype.getGroup = function (groupRef) {
|
|
|
1495
1495
|
*/
|
|
1496
1496
|
DataView.prototype._getGroupByContentRowId = function (rowId) {
|
|
1497
1497
|
if(this._groupMembers) {
|
|
1498
|
-
for (
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1498
|
+
for (let i = 0; i < this._groupList.length; i++) {
|
|
1499
|
+
let groupId = this._groupList[i];
|
|
1500
|
+
let grp = this._groupMembers[groupId];
|
|
1501
|
+
let childGroup = grp._getGroupByContentRowId(rowId);
|
|
1502
1502
|
if(childGroup) {
|
|
1503
1503
|
return childGroup;
|
|
1504
1504
|
}
|
|
@@ -1518,10 +1518,10 @@ DataView.prototype._getGroupByContentRowId = function (rowId) {
|
|
|
1518
1518
|
DataView.prototype.getAllGroups = function (out_ary) {
|
|
1519
1519
|
if(!out_ary) { out_ary = []; }
|
|
1520
1520
|
if(this._groupMembers) {
|
|
1521
|
-
|
|
1522
|
-
for(
|
|
1523
|
-
|
|
1524
|
-
|
|
1521
|
+
let len = this._groupList.length;
|
|
1522
|
+
for(let i = 0; i < len; ++i) {
|
|
1523
|
+
let groupId = this._groupList[i];
|
|
1524
|
+
let grp = this._groupMembers[groupId];
|
|
1525
1525
|
out_ary.push(grp);
|
|
1526
1526
|
grp.getAllGroups(out_ary);
|
|
1527
1527
|
}
|
|
@@ -1564,7 +1564,7 @@ DataView.prototype.getGroupRowId = function () {
|
|
|
1564
1564
|
*/
|
|
1565
1565
|
DataView.prototype.getFooterRowIndex = function (rid) {
|
|
1566
1566
|
if(this._footerRowIds) {
|
|
1567
|
-
for(
|
|
1567
|
+
for(let i = this._footerRowIds.length; --i >= 0;) {
|
|
1568
1568
|
if(this._footerRowIds[i] === rid) {
|
|
1569
1569
|
return i;
|
|
1570
1570
|
}
|
|
@@ -1604,17 +1604,17 @@ DataView.prototype.getGroupLevel = function (rowRef) {
|
|
|
1604
1604
|
if(rowRef != null && this._groupRows) {
|
|
1605
1605
|
if(typeof rowRef === 'number'){ // TODO: Change logic to acquire row id from row index instead
|
|
1606
1606
|
this._rebuildRowIdsFromChildren();
|
|
1607
|
-
|
|
1608
|
-
|
|
1607
|
+
let rids = this._getRids(); // TODO : Should include hidden rows
|
|
1608
|
+
let rid = rids[rowRef];
|
|
1609
1609
|
while(rid) {
|
|
1610
|
-
|
|
1610
|
+
let dv = this._groupRows[rid];
|
|
1611
1611
|
if(dv) {
|
|
1612
1612
|
return dv._groupLevel;
|
|
1613
1613
|
}
|
|
1614
1614
|
rid = rids[--rowRef];
|
|
1615
1615
|
}
|
|
1616
1616
|
} else {
|
|
1617
|
-
|
|
1617
|
+
let currentGroup = this.getGroup(rowRef); // Slow becuase recursive
|
|
1618
1618
|
if(currentGroup) {
|
|
1619
1619
|
return currentGroup._groupLevel;
|
|
1620
1620
|
}
|
|
@@ -1633,8 +1633,8 @@ DataView.prototype.getGroupLevel = function (rowRef) {
|
|
|
1633
1633
|
*/
|
|
1634
1634
|
DataView.prototype.enableColumnStats = function(cid, opt_enabled, opt_refId) {
|
|
1635
1635
|
if (!cid) { return null; }
|
|
1636
|
-
|
|
1637
|
-
|
|
1636
|
+
let enabled = opt_enabled !== false;
|
|
1637
|
+
let cs = this._columnStats[cid];
|
|
1638
1638
|
if(enabled) {
|
|
1639
1639
|
if(!cs) {
|
|
1640
1640
|
cs = new ColumnStats(this, cid);
|
|
@@ -1650,8 +1650,8 @@ DataView.prototype.enableColumnStats = function(cid, opt_enabled, opt_refId) {
|
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
if(this._groupMembers) {
|
|
1653
|
-
for(
|
|
1654
|
-
|
|
1653
|
+
for(let i = this._groupList.length; --i >= 0;) {
|
|
1654
|
+
let groupId = this._groupList[i];
|
|
1655
1655
|
this._groupMembers[groupId].enableColumnStats(cid, opt_enabled, opt_refId);
|
|
1656
1656
|
}
|
|
1657
1657
|
}
|
|
@@ -1671,7 +1671,7 @@ DataView.prototype.getColumnStats = function(cid) {
|
|
|
1671
1671
|
* @returns {boolean}
|
|
1672
1672
|
*/
|
|
1673
1673
|
DataView.prototype.hide = function(opt_hidden) {
|
|
1674
|
-
|
|
1674
|
+
let val = opt_hidden !== false;
|
|
1675
1675
|
if(this._hidden === val) {
|
|
1676
1676
|
return false;
|
|
1677
1677
|
}
|
|
@@ -1743,7 +1743,7 @@ DataView.prototype._setCollapse = function(collapsed) {
|
|
|
1743
1743
|
* @param {boolean=} opt_collapsed
|
|
1744
1744
|
*/
|
|
1745
1745
|
DataView.prototype.collapse = function(opt_collapsed) {
|
|
1746
|
-
|
|
1746
|
+
let dirty = this._setCollapse(opt_collapsed !== false);
|
|
1747
1747
|
|
|
1748
1748
|
if(dirty) {
|
|
1749
1749
|
if (this._shared.contentAsHeader) {
|
|
@@ -1762,12 +1762,12 @@ DataView.prototype.collapse = function(opt_collapsed) {
|
|
|
1762
1762
|
* @param {boolean=} opt_collapsed
|
|
1763
1763
|
*/
|
|
1764
1764
|
DataView.prototype.collapseAllGroups = function(opt_collapsed) {
|
|
1765
|
-
|
|
1766
|
-
|
|
1765
|
+
let grpList = this.getAllGroups();
|
|
1766
|
+
let len = grpList.length;
|
|
1767
1767
|
if(len) {
|
|
1768
|
-
|
|
1769
|
-
for(
|
|
1770
|
-
|
|
1768
|
+
let collapsed = (opt_collapsed !== false);
|
|
1769
|
+
for(let i = 0; i < len; ++i) {
|
|
1770
|
+
let grpItem = grpList[i];
|
|
1771
1771
|
grpItem._setCollapse(collapsed);
|
|
1772
1772
|
}
|
|
1773
1773
|
this._requestRebuildingRowIds(false);
|
|
@@ -1846,7 +1846,7 @@ DataView.prototype.getGroupColor = function() {
|
|
|
1846
1846
|
DataView.prototype._getFirstHiddenRids = function() {
|
|
1847
1847
|
if(this._shared.contentAsHeader) {
|
|
1848
1848
|
if(this._showOnlyFirstMember) {
|
|
1849
|
-
|
|
1849
|
+
let rids = this._rids;
|
|
1850
1850
|
if (Array.isArray(rids) && rids.length) {
|
|
1851
1851
|
return [rids[0]]; // Get only the first member of rids
|
|
1852
1852
|
}
|
|
@@ -1874,8 +1874,8 @@ DataView.prototype.getVisibleRowCount = function() {
|
|
|
1874
1874
|
* @return {boolean}
|
|
1875
1875
|
*/
|
|
1876
1876
|
DataView.prototype.isRowDataInGroup = function (rowData, groupID) {
|
|
1877
|
-
|
|
1878
|
-
|
|
1877
|
+
let criteria = this._groupCriteria;
|
|
1878
|
+
let level = this._groupLevel;
|
|
1879
1879
|
|
|
1880
1880
|
// Because self is a leaf group, only check against self.
|
|
1881
1881
|
if (!groupID || groupID === this.getGroupId()) {
|
|
@@ -1883,7 +1883,7 @@ DataView.prototype.isRowDataInGroup = function (rowData, groupID) {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
|
|
1885
1885
|
// Check against self and all sub groups within self
|
|
1886
|
-
for (
|
|
1886
|
+
for (let i = level; i < criteria.length; i++) {
|
|
1887
1887
|
if (criteria[i](rowData).indexOf(groupID) >= 0) {
|
|
1888
1888
|
return true;
|
|
1889
1889
|
}
|
|
@@ -1898,7 +1898,7 @@ DataView.prototype.isRowDataInGroup = function (rowData, groupID) {
|
|
|
1898
1898
|
* @return {boolean}
|
|
1899
1899
|
*/
|
|
1900
1900
|
DataView.prototype.isRowIdInGroup = function (rowId, groupID) {
|
|
1901
|
-
|
|
1901
|
+
let rowData = this.getRowData(rowId);
|
|
1902
1902
|
if(rowData) {
|
|
1903
1903
|
return this.isRowDataInGroup(rowData, groupID);
|
|
1904
1904
|
}
|
|
@@ -1932,25 +1932,25 @@ DataView.prototype.addRowExpansion = function(rid, count) {
|
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
1934
|
|
|
1935
|
-
|
|
1935
|
+
let rowIndex = this._rids.indexOf(rid);
|
|
1936
1936
|
if(rowIndex < 0) {
|
|
1937
1937
|
// The given row id must be normal row. header and expansion row are not in the this._rids list
|
|
1938
1938
|
return;
|
|
1939
1939
|
}
|
|
1940
1940
|
|
|
1941
|
-
|
|
1941
|
+
let expCount = 0;
|
|
1942
1942
|
if(this._expansionMap) {
|
|
1943
1943
|
expCount = this._expansionMap[rid] || 0;
|
|
1944
1944
|
} else {
|
|
1945
1945
|
this._expansionMap = {};
|
|
1946
1946
|
this._expansionChildren = {};
|
|
1947
1947
|
}
|
|
1948
|
-
|
|
1948
|
+
let totalChild = expCount + count;
|
|
1949
1949
|
this._expansionMap[rid] = totalChild;
|
|
1950
1950
|
|
|
1951
1951
|
// create _expansionChildren mapping
|
|
1952
1952
|
|
|
1953
|
-
for (
|
|
1953
|
+
for (let i = expCount; i < totalChild; i++) {
|
|
1954
1954
|
this._expansionChildren[DataView._getDataViewExpansionId(rid, i)] = rid;
|
|
1955
1955
|
}
|
|
1956
1956
|
|
|
@@ -1964,7 +1964,7 @@ DataView.prototype.addRowExpansion = function(rid, count) {
|
|
|
1964
1964
|
}
|
|
1965
1965
|
|
|
1966
1966
|
if(this._updateExpansionView()) {
|
|
1967
|
-
|
|
1967
|
+
let e = {}; // Slow
|
|
1968
1968
|
e["rid"] = rid;
|
|
1969
1969
|
e["type"] = "inserted";
|
|
1970
1970
|
e["nextRid"] = this._rids[rowIndex + 1];
|
|
@@ -1980,13 +1980,13 @@ DataView.prototype.removeRowExpansion = function(rid) {
|
|
|
1980
1980
|
if(!this._expansionMap) {
|
|
1981
1981
|
return;
|
|
1982
1982
|
}
|
|
1983
|
-
|
|
1983
|
+
let expCount = this._expansionMap[rid];
|
|
1984
1984
|
if(!expCount) {
|
|
1985
1985
|
return;
|
|
1986
1986
|
}
|
|
1987
1987
|
|
|
1988
|
-
|
|
1989
|
-
for (
|
|
1988
|
+
let rids = new Array(expCount);
|
|
1989
|
+
for (let i = 0; i < expCount; ++i) {
|
|
1990
1990
|
rids[i] = DataView._getDataViewExpansionId(rid, i);
|
|
1991
1991
|
delete this._expansionChildren[rids[i]];
|
|
1992
1992
|
}
|
|
@@ -2011,7 +2011,7 @@ DataView.prototype.removeRowExpansion = function(rid) {
|
|
|
2011
2011
|
* @param {number=} count=1
|
|
2012
2012
|
*/
|
|
2013
2013
|
DataView.prototype.toggleRowExpansion = function(rowRef, force, count) {
|
|
2014
|
-
|
|
2014
|
+
let rid = this._toRowId(rowRef);
|
|
2015
2015
|
|
|
2016
2016
|
if(force != null) {
|
|
2017
2017
|
force = force === true;
|
|
@@ -2047,17 +2047,17 @@ DataView.prototype.getRowsWithExpansion = function(from, to) {
|
|
|
2047
2047
|
if(!this._expansionMap) {
|
|
2048
2048
|
return [];
|
|
2049
2049
|
}
|
|
2050
|
-
|
|
2051
|
-
|
|
2050
|
+
let rids = this._expansionView;
|
|
2051
|
+
let len = rids.length;
|
|
2052
2052
|
if(to == null) { to = len; }
|
|
2053
2053
|
else if(to > len) { to = len; }
|
|
2054
2054
|
|
|
2055
2055
|
if(!(from > 0)) { from = 0; } // Handle NaN, undefined, null, and other invalid value
|
|
2056
2056
|
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
for(
|
|
2060
|
-
|
|
2057
|
+
let entryCount = this._expansionCount;
|
|
2058
|
+
let out_ary = new Array(len);
|
|
2059
|
+
for(let i = from; i < to; ++i) {
|
|
2060
|
+
let rid = rids[i];
|
|
2061
2061
|
if(this._expansionMap[rid]) {
|
|
2062
2062
|
out_ary[i] = rid;
|
|
2063
2063
|
if(--entryCount <= 0) {
|
|
@@ -2074,10 +2074,10 @@ DataView.prototype.getRowsWithExpansion = function(from, to) {
|
|
|
2074
2074
|
* @return {Array.<string>} object mapping of rowIndex and parentRowId
|
|
2075
2075
|
*/
|
|
2076
2076
|
DataView.prototype.getExpansionParents = function (from, to) {
|
|
2077
|
-
|
|
2077
|
+
let parentMapping = [];
|
|
2078
2078
|
if (this._expansionMap) {
|
|
2079
|
-
|
|
2080
|
-
|
|
2079
|
+
let rids = this._expansionView;
|
|
2080
|
+
let len = rids.length;
|
|
2081
2081
|
|
|
2082
2082
|
// Handle NaN, undefined, null, and other invalid values
|
|
2083
2083
|
if (to == null || to > len) {
|
|
@@ -2087,7 +2087,7 @@ DataView.prototype.getExpansionParents = function (from, to) {
|
|
|
2087
2087
|
from = 0;
|
|
2088
2088
|
}
|
|
2089
2089
|
|
|
2090
|
-
for (
|
|
2090
|
+
for (let i = from; i < to; ++i) {
|
|
2091
2091
|
parentMapping[i] = this._expansionChildren[rids[i]] || "";
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
@@ -2147,7 +2147,7 @@ DataView.prototype.getRowExpansionCount = function(rowId) {
|
|
|
2147
2147
|
*/
|
|
2148
2148
|
DataView.prototype.getRowExpansionId = function(rid, idx) {
|
|
2149
2149
|
if(this._expansionMap) {
|
|
2150
|
-
|
|
2150
|
+
let expCount = this._expansionMap[rid] || 0;
|
|
2151
2151
|
if(!idx) {
|
|
2152
2152
|
idx = 0;
|
|
2153
2153
|
}
|
|
@@ -2165,7 +2165,7 @@ DataView.prototype.getRowExpansionId = function(rid, idx) {
|
|
|
2165
2165
|
*/
|
|
2166
2166
|
DataView.prototype.getRowExpansionIndex = function(rid) {
|
|
2167
2167
|
if(rid) {
|
|
2168
|
-
|
|
2168
|
+
let matches = rid.match(/_ex(\d+)$/);
|
|
2169
2169
|
if(matches) {
|
|
2170
2170
|
return +matches[1]; // TODO: Check for NaN value
|
|
2171
2171
|
}
|
|
@@ -2176,7 +2176,7 @@ DataView.prototype.getRowExpansionIndex = function(rid) {
|
|
|
2176
2176
|
* @return {boolean}
|
|
2177
2177
|
*/
|
|
2178
2178
|
DataView.prototype._updateExpansionView = function() {
|
|
2179
|
-
|
|
2179
|
+
let expMap = this._expansionMap;
|
|
2180
2180
|
if(expMap) {
|
|
2181
2181
|
if(!this._expansionCount || this._expansionCount < 0) {
|
|
2182
2182
|
this._expansionCount = 0;
|
|
@@ -2186,22 +2186,22 @@ DataView.prototype._updateExpansionView = function() {
|
|
|
2186
2186
|
return true;
|
|
2187
2187
|
}
|
|
2188
2188
|
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2189
|
+
let rids = this._pageView || this._groupView || this._rids;
|
|
2190
|
+
let rowLen = rids.length;
|
|
2191
|
+
let origLen = this._expansionView ? this._expansionView.length : 0;
|
|
2192
2192
|
if(!this._expansionView) {
|
|
2193
2193
|
this._expansionView = new Array(rowLen);
|
|
2194
2194
|
} else {
|
|
2195
2195
|
this._expansionView.length = rowLen;
|
|
2196
2196
|
}
|
|
2197
|
-
|
|
2198
|
-
for(
|
|
2199
|
-
|
|
2197
|
+
let entryCount = this._expansionCount;
|
|
2198
|
+
for(let i = 0, j = 0; i < rowLen; ++i) {
|
|
2199
|
+
let rid = rids[i];
|
|
2200
2200
|
this._expansionView[j++] = rid;
|
|
2201
2201
|
if(entryCount) {
|
|
2202
|
-
|
|
2202
|
+
let expCount = expMap[rid] || 0;
|
|
2203
2203
|
if(expCount) {
|
|
2204
|
-
for(
|
|
2204
|
+
for(let k = 0; k < expCount; ++k) {
|
|
2205
2205
|
this._expansionView[j++] = DataView._getDataViewExpansionId(rid, k);
|
|
2206
2206
|
}
|
|
2207
2207
|
--entryCount;
|
|
@@ -2219,7 +2219,7 @@ DataView.prototype._updateExpansionView = function() {
|
|
|
2219
2219
|
* @return {boolean}
|
|
2220
2220
|
*/
|
|
2221
2221
|
DataView.prototype._transformView = function(firstChange) {
|
|
2222
|
-
|
|
2222
|
+
let dirty = this._updatePaginationView(firstChange);
|
|
2223
2223
|
dirty |= this._updateExpansionView();
|
|
2224
2224
|
return dirty ? true : false;
|
|
2225
2225
|
};
|
|
@@ -2234,12 +2234,12 @@ DataView.prototype.searchAll = function(searchLogic, opt_out) {
|
|
|
2234
2234
|
if(!opt_out) { opt_out = []; }
|
|
2235
2235
|
|
|
2236
2236
|
this._rebuildRowIdsFromChildren();
|
|
2237
|
-
|
|
2238
|
-
|
|
2237
|
+
let rids = this._getRids();
|
|
2238
|
+
let len = rids.length;
|
|
2239
2239
|
|
|
2240
|
-
for(
|
|
2241
|
-
|
|
2242
|
-
|
|
2240
|
+
for(let i = 0; i < len; ++i) {
|
|
2241
|
+
let rid = rids[i];
|
|
2242
|
+
let row = this._dt.getRowData(rid);
|
|
2243
2243
|
if(row) {
|
|
2244
2244
|
if(searchLogic(row)) {
|
|
2245
2245
|
opt_out.push(rid);
|
|
@@ -2256,8 +2256,8 @@ DataView.prototype.searchAll = function(searchLogic, opt_out) {
|
|
|
2256
2256
|
*/
|
|
2257
2257
|
DataView.prototype.searchPrev = function(rowRef, searchLogic) {
|
|
2258
2258
|
this._rebuildRowIdsFromChildren();
|
|
2259
|
-
|
|
2260
|
-
|
|
2259
|
+
let rids = this._getRids();
|
|
2260
|
+
let rowIndex = -1;
|
|
2261
2261
|
if(typeof rowRef === "number") {
|
|
2262
2262
|
if(this._dt.getRowData(rids[rowRef])) {
|
|
2263
2263
|
rowIndex = rowRef;
|
|
@@ -2266,8 +2266,8 @@ DataView.prototype.searchPrev = function(rowRef, searchLogic) {
|
|
|
2266
2266
|
rowIndex = rids.indexOf(rowRef);
|
|
2267
2267
|
}
|
|
2268
2268
|
|
|
2269
|
-
|
|
2270
|
-
|
|
2269
|
+
let foundAt = -1;
|
|
2270
|
+
let len = rids.length;
|
|
2271
2271
|
if(rowIndex > 0) {
|
|
2272
2272
|
foundAt = this._searchRow(rids, searchLogic, rowIndex - 1, -1, -1);
|
|
2273
2273
|
if(foundAt >= 0) {
|
|
@@ -2290,8 +2290,8 @@ DataView.prototype.searchPrev = function(rowRef, searchLogic) {
|
|
|
2290
2290
|
*/
|
|
2291
2291
|
DataView.prototype.searchNext = function(rowRef, searchLogic) {
|
|
2292
2292
|
this._rebuildRowIdsFromChildren();
|
|
2293
|
-
|
|
2294
|
-
|
|
2293
|
+
let rids = this._getRids();
|
|
2294
|
+
let rowIndex = -1;
|
|
2295
2295
|
if(typeof rowRef === "number") {
|
|
2296
2296
|
if(this._dt.getRowData(rids[rowRef])) {
|
|
2297
2297
|
rowIndex = rowRef;
|
|
@@ -2303,8 +2303,8 @@ DataView.prototype.searchNext = function(rowRef, searchLogic) {
|
|
|
2303
2303
|
return -1;
|
|
2304
2304
|
}
|
|
2305
2305
|
|
|
2306
|
-
|
|
2307
|
-
|
|
2306
|
+
let foundAt = -1;
|
|
2307
|
+
let len = rids.length;
|
|
2308
2308
|
if(rowIndex < len - 1) {
|
|
2309
2309
|
foundAt = this._searchRow(rids, searchLogic, rowIndex + 1, len, 1);
|
|
2310
2310
|
if(foundAt >= 0) {
|
|
@@ -2330,8 +2330,8 @@ DataView.prototype.searchNext = function(rowRef, searchLogic) {
|
|
|
2330
2330
|
*/
|
|
2331
2331
|
DataView.prototype._searchRow = function(rids, searchLogic, start, end, inc) {
|
|
2332
2332
|
while(start !== end) {
|
|
2333
|
-
|
|
2334
|
-
|
|
2333
|
+
let rid = rids[start];
|
|
2334
|
+
let row = this._dt.getRowData(rid);
|
|
2335
2335
|
if(row) {
|
|
2336
2336
|
if(searchLogic(row)) {
|
|
2337
2337
|
return start;
|
|
@@ -2348,15 +2348,15 @@ DataView.prototype._searchRow = function(rids, searchLogic, start, end, inc) {
|
|
|
2348
2348
|
* @return {boolean} True if there is any change
|
|
2349
2349
|
*/
|
|
2350
2350
|
DataView.prototype.stall = function(opt_bool) {
|
|
2351
|
-
|
|
2352
|
-
|
|
2351
|
+
let newBool = opt_bool !== false;
|
|
2352
|
+
let curBool = this._shared.stalledRids ? true : false;
|
|
2353
2353
|
if(curBool === newBool) { return false; }
|
|
2354
2354
|
if(newBool) {
|
|
2355
|
-
|
|
2355
|
+
let srs = {};
|
|
2356
2356
|
this._shared.stalledRids = srs;
|
|
2357
|
-
|
|
2357
|
+
let rids = this._getRids();
|
|
2358
2358
|
|
|
2359
|
-
for(
|
|
2359
|
+
for(let i = rids.length; --i >= 0;) {
|
|
2360
2360
|
srs[rids[i]] = 1;
|
|
2361
2361
|
}
|
|
2362
2362
|
} else {
|
|
@@ -2372,7 +2372,7 @@ DataView.prototype.stall = function(opt_bool) {
|
|
|
2372
2372
|
*/
|
|
2373
2373
|
DataView.prototype.enableAutoGroupRemoval = function(opt_bool) {
|
|
2374
2374
|
opt_bool = opt_bool !== false;
|
|
2375
|
-
|
|
2375
|
+
let autoGroupRemoval = this._shared.autoGroupRemoval ? true : false;
|
|
2376
2376
|
if(autoGroupRemoval !== opt_bool) {
|
|
2377
2377
|
this._shared.autoGroupRemoval = opt_bool;
|
|
2378
2378
|
this._triggerGroupRefreshing();
|
|
@@ -2387,7 +2387,7 @@ DataView.prototype.enableAutoGroupRemoval = function(opt_bool) {
|
|
|
2387
2387
|
*/
|
|
2388
2388
|
DataView.prototype.enableAutoGroupHiding = function(opt_bool) {
|
|
2389
2389
|
opt_bool = opt_bool !== false;
|
|
2390
|
-
|
|
2390
|
+
let autoGroupHiding = this._shared.autoGroupHiding ? true : false;
|
|
2391
2391
|
if(autoGroupHiding !== opt_bool) {
|
|
2392
2392
|
this._shared.autoGroupHiding = opt_bool;
|
|
2393
2393
|
this._triggerGroupRefreshing();
|
|
@@ -2411,7 +2411,7 @@ DataView.prototype.synchronizeRowOrder = function() {
|
|
|
2411
2411
|
* @return {boolean} Return true if there is any change
|
|
2412
2412
|
*/
|
|
2413
2413
|
DataView.prototype.setSegmentSeparator = function(rowRef, enabled) {
|
|
2414
|
-
|
|
2414
|
+
let rowId = "";
|
|
2415
2415
|
if(typeof rowRef === "number") {
|
|
2416
2416
|
rowId = this.getRowId(rowRef);
|
|
2417
2417
|
} else if(typeof rowRef === "string") {
|
|
@@ -2462,7 +2462,7 @@ DataView.prototype.getSegment = function(rid) {
|
|
|
2462
2462
|
/**
|
|
2463
2463
|
* @public
|
|
2464
2464
|
* @param {string} rid Row id of a segment child
|
|
2465
|
-
* @return {
|
|
2465
|
+
* @return {Segment} Returns null if a segment cannot be found
|
|
2466
2466
|
*/
|
|
2467
2467
|
DataView.prototype.getSegmentParent = function(rid) {
|
|
2468
2468
|
return this._dt.getSegmentParent(rid);
|
|
@@ -2490,9 +2490,9 @@ DataView.prototype.getSegmentParentRowId = function(rid) {
|
|
|
2490
2490
|
*/
|
|
2491
2491
|
DataView.prototype.collapseSegment = function(rowRef, collapsed) {
|
|
2492
2492
|
collapsed = collapsed !== false;
|
|
2493
|
-
|
|
2493
|
+
let segments = this._dt._getSegmentSeparators();
|
|
2494
2494
|
if(segments) {
|
|
2495
|
-
|
|
2495
|
+
let segmentRid = this._toRowId(rowRef);
|
|
2496
2496
|
|
|
2497
2497
|
if(segments.collapseSegment(segmentRid, collapsed)) {
|
|
2498
2498
|
this._refreshAndNotify(); // dispatch global change event
|
|
@@ -2515,7 +2515,7 @@ DataView.prototype.expandSegment = function(rowRef, expanded) {
|
|
|
2515
2515
|
* @return {boolean} Return true if there is any change
|
|
2516
2516
|
*/
|
|
2517
2517
|
DataView.prototype.expandAllSegments = function() {
|
|
2518
|
-
|
|
2518
|
+
let segments = this._dt._getSegmentSeparators();
|
|
2519
2519
|
if(segments) {
|
|
2520
2520
|
if(segments.expandAllSegments()) {
|
|
2521
2521
|
this._refreshAndNotify();
|
|
@@ -2534,7 +2534,7 @@ DataView.prototype.setSegmentCollapsingLogic = function() {};
|
|
|
2534
2534
|
* @return {boolean} Return true if only the given row is a collapsed segment separator
|
|
2535
2535
|
*/
|
|
2536
2536
|
DataView.prototype.isSegmentCollapsed = function(rowRef) {
|
|
2537
|
-
|
|
2537
|
+
let segments = this._dt._getSegmentSeparators();
|
|
2538
2538
|
if(segments) {
|
|
2539
2539
|
return segments.isCollapsedSegment(this._toRowId(rowRef));
|
|
2540
2540
|
}
|
|
@@ -2561,8 +2561,8 @@ DataView.prototype.fillSegments = function() {
|
|
|
2561
2561
|
*/
|
|
2562
2562
|
DataView.prototype.addSegmentChild = function(segmentRef, rowRef, dataId) {
|
|
2563
2563
|
if(this._dt._getSegmentSeparators()) {
|
|
2564
|
-
|
|
2565
|
-
|
|
2564
|
+
let segmentId = this._toRowId(segmentRef);
|
|
2565
|
+
let rowId = this._toRowId(rowRef);
|
|
2566
2566
|
return this._dt.addSegmentChild(segmentId, rowId, dataId);
|
|
2567
2567
|
}
|
|
2568
2568
|
return false;
|
|
@@ -2575,8 +2575,8 @@ DataView.prototype.addSegmentChild = function(segmentRef, rowRef, dataId) {
|
|
|
2575
2575
|
*/
|
|
2576
2576
|
DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs, dataIds) {
|
|
2577
2577
|
if(this._dt._getSegmentSeparators()) {
|
|
2578
|
-
|
|
2579
|
-
|
|
2578
|
+
let segmentId = this._toRowId(segmentRef);
|
|
2579
|
+
let rowIds = this._toRowIds(rowRefs);
|
|
2580
2580
|
return this._dt.addSegmentChildren(segmentId, rowIds, dataIds);
|
|
2581
2581
|
}
|
|
2582
2582
|
return false;
|
|
@@ -2588,8 +2588,8 @@ DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs, dataIds) {
|
|
|
2588
2588
|
*/
|
|
2589
2589
|
DataView.prototype.removeSegmentChild = function(segmentRef, rowRef) {
|
|
2590
2590
|
if(this._dt._getSegmentSeparators()) {
|
|
2591
|
-
|
|
2592
|
-
|
|
2591
|
+
let segmentId = this._toRowId(segmentRef);
|
|
2592
|
+
let rowId = this._toRowId(rowRef);
|
|
2593
2593
|
return this._dt.removeSegmentChild(segmentId, rowId); // TODO: Handle the case where a child is remove from its collapsed parent. Child should be made visible
|
|
2594
2594
|
}
|
|
2595
2595
|
return false;
|
|
@@ -2601,8 +2601,8 @@ DataView.prototype.removeSegmentChild = function(segmentRef, rowRef) {
|
|
|
2601
2601
|
*/
|
|
2602
2602
|
DataView.prototype.removeSegmentChildren = function(segmentRef, rowRefs) {
|
|
2603
2603
|
if(this._dt._getSegmentSeparators()) {
|
|
2604
|
-
|
|
2605
|
-
|
|
2604
|
+
let segmentId = this._toRowId(segmentRef);
|
|
2605
|
+
let rowIds = this._toRowIds(rowRefs);
|
|
2606
2606
|
return this._dt.removeSegmentChildren(segmentId, rowIds); // TODO: Handle the case where a child is remove from its collapsed parent. Child should be made visible
|
|
2607
2607
|
}
|
|
2608
2608
|
return false;
|
|
@@ -2727,15 +2727,15 @@ DataView.prototype.wrapView = function (wrapSize) {
|
|
|
2727
2727
|
*/
|
|
2728
2728
|
DataView.prototype._updateWrapCount = function () {
|
|
2729
2729
|
this._wrapTimerId = 0;
|
|
2730
|
-
|
|
2730
|
+
let wrapSize = this._wrapSize;
|
|
2731
2731
|
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2732
|
+
let i;
|
|
2733
|
+
let views = this._wrappedViews;
|
|
2734
|
+
let viewCount = views ? views.length : 0;
|
|
2735
|
+
let targetCount = 0;
|
|
2736
2736
|
if(wrapSize) {
|
|
2737
|
-
|
|
2738
|
-
|
|
2737
|
+
let rids = this.getVisibleRowIds(true);
|
|
2738
|
+
let rowCount = rids.length;
|
|
2739
2739
|
targetCount = Math.ceil(rowCount / wrapSize);
|
|
2740
2740
|
if(viewCount < targetCount) {
|
|
2741
2741
|
if(!views) {
|
|
@@ -2777,7 +2777,7 @@ DataView.prototype._updateWrapCount = function () {
|
|
|
2777
2777
|
*/
|
|
2778
2778
|
DataView.prototype.dump = function(opt_options) {
|
|
2779
2779
|
this._rebuildRowIdsFromChildren();
|
|
2780
|
-
|
|
2780
|
+
let rids = this._getRids();
|
|
2781
2781
|
|
|
2782
2782
|
return DataCache.constructTable(this.getMultipleRowData(rids), opt_options, rids);
|
|
2783
2783
|
};
|
|
@@ -2795,7 +2795,7 @@ DataView.prototype.dump = function(opt_options) {
|
|
|
2795
2795
|
//}
|
|
2796
2796
|
dv.log({"rowCount": 10}); // Showing 10 records
|
|
2797
2797
|
dv.log({"getter": function(rowData, colName){
|
|
2798
|
-
|
|
2798
|
+
let complexData = rowData[colName];
|
|
2799
2799
|
return complextData.someProperty;
|
|
2800
2800
|
}});
|
|
2801
2801
|
*/
|
|
@@ -2832,13 +2832,13 @@ DataView.prototype._updateRowIds = function(opt_rowIds) {
|
|
|
2832
2832
|
this._dispatch("beforeFiltering", {});
|
|
2833
2833
|
|
|
2834
2834
|
this._excludedRids = {};
|
|
2835
|
-
|
|
2835
|
+
let exclusionCount = 0;
|
|
2836
2836
|
exclusionCount += DataView._copyObjectKeys(this._excludedRids, this._hiddenRids);
|
|
2837
2837
|
|
|
2838
2838
|
// Segment separators should not be filtered out (hidden)
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2839
|
+
let segments = this._dt._getSegmentSeparators();
|
|
2840
|
+
let segmentIds = segments ? segments.getSegments() : null;
|
|
2841
|
+
let userRemoval = this._getRemovalMap(
|
|
2842
2842
|
this._excludedRids,
|
|
2843
2843
|
this._userFilter,
|
|
2844
2844
|
this._filteringOut,
|
|
@@ -2867,8 +2867,8 @@ DataView.prototype._updateRowIds = function(opt_rowIds) {
|
|
|
2867
2867
|
if(this._groupMembers) { // Has grouping
|
|
2868
2868
|
this._populateGroups(); // View will be properly re-populate inside _populateGroups()
|
|
2869
2869
|
} else { // No grouping
|
|
2870
|
-
|
|
2871
|
-
|
|
2870
|
+
let pageIndexChanged = this._updatePageCount();
|
|
2871
|
+
let sorted = this._sort();
|
|
2872
2872
|
if(!sorted && !pageIndexChanged) {
|
|
2873
2873
|
this._transformView();
|
|
2874
2874
|
}
|
|
@@ -2880,19 +2880,19 @@ DataView.prototype._updateRowIds = function(opt_rowIds) {
|
|
|
2880
2880
|
DataView.prototype._onDataChanged = function (e) {
|
|
2881
2881
|
if (this._conflator.conflate(e)) return;
|
|
2882
2882
|
|
|
2883
|
-
|
|
2883
|
+
let events = this._conflator.popAllData() || [e];
|
|
2884
2884
|
|
|
2885
2885
|
// process all events
|
|
2886
|
-
|
|
2886
|
+
let eventsCount = events.length;
|
|
2887
2887
|
if (eventsCount === 1) {
|
|
2888
|
-
|
|
2888
|
+
let event = events[0];
|
|
2889
2889
|
if (event["globalChange"]) {
|
|
2890
2890
|
this._updateRowIds(); // Reset all row ids and perform sorting
|
|
2891
2891
|
this._dispatchDataChange(event);
|
|
2892
2892
|
return;
|
|
2893
2893
|
}
|
|
2894
2894
|
|
|
2895
|
-
|
|
2895
|
+
let type = event["type"];
|
|
2896
2896
|
if (type === "inserted") {
|
|
2897
2897
|
this._onRowInserted(event);
|
|
2898
2898
|
} else if (type === "removed") {
|
|
@@ -2903,8 +2903,8 @@ DataView.prototype._onDataChanged = function (e) {
|
|
|
2903
2903
|
} else {
|
|
2904
2904
|
// multi event should occur globalchange
|
|
2905
2905
|
this._updateRowIds(); // Reset all row ids and perform sorting
|
|
2906
|
-
|
|
2907
|
-
for (
|
|
2906
|
+
let positionChangeOnly = true;
|
|
2907
|
+
for (let i = 0; i < eventsCount; i++) {
|
|
2908
2908
|
if (!events[i].positionChangeOnly) {
|
|
2909
2909
|
positionChangeOnly = false;
|
|
2910
2910
|
break;
|
|
@@ -2930,21 +2930,21 @@ DataView.prototype._onRowInserted = function(e) { // onInsert
|
|
|
2930
2930
|
return 0;
|
|
2931
2931
|
}
|
|
2932
2932
|
|
|
2933
|
-
|
|
2933
|
+
let ret = 0;
|
|
2934
2934
|
if(this._groupMembers) {
|
|
2935
|
-
|
|
2936
|
-
|
|
2935
|
+
let gids = this._resolveGroupId(e["rowData"]);
|
|
2936
|
+
let groupLen = gids.length;
|
|
2937
2937
|
if(groupLen > 1) {
|
|
2938
2938
|
// activate multi-group row mode
|
|
2939
2939
|
this._shared.multiGroupRow = true;
|
|
2940
2940
|
}
|
|
2941
|
-
|
|
2942
|
-
for(
|
|
2941
|
+
let gid;
|
|
2942
|
+
for(let i = 0; i < groupLen; i++) {
|
|
2943
2943
|
gid = gids[i];
|
|
2944
2944
|
if(this._groupMembers[gid]) { // Insert to existing member
|
|
2945
2945
|
ret = this._groupMembers[gid]._onRowInserted(e);
|
|
2946
2946
|
} else {
|
|
2947
|
-
|
|
2947
|
+
let member = this._addGroup(gid);
|
|
2948
2948
|
if(member) {
|
|
2949
2949
|
e["globalChange"] = true;
|
|
2950
2950
|
member._onRowInserted(e);
|
|
@@ -2961,23 +2961,23 @@ DataView.prototype._onRowInserted = function(e) { // onInsert
|
|
|
2961
2961
|
return ret; // the view is hidden and there is no need to be updated
|
|
2962
2962
|
}
|
|
2963
2963
|
|
|
2964
|
-
|
|
2965
|
-
|
|
2964
|
+
let rid = e["rid"];
|
|
2965
|
+
let rowData = e["rowData"];
|
|
2966
2966
|
|
|
2967
2967
|
if(!this._isAllowedInGroup(rid, rowData)) {
|
|
2968
2968
|
return ret;
|
|
2969
2969
|
}
|
|
2970
2970
|
|
|
2971
|
-
|
|
2972
|
-
|
|
2971
|
+
let nextRid = /** @type{string} */(e["nextRid"]);
|
|
2972
|
+
let rowIndex;
|
|
2973
2973
|
if(this.isSorting() && !e["segmentChanged"]) {
|
|
2974
2974
|
rowIndex = this._addDataRow(rid);
|
|
2975
2975
|
} else {
|
|
2976
2976
|
rowIndex = this._addDataRow(rid, nextRid, e["fallback"]);
|
|
2977
2977
|
}
|
|
2978
2978
|
|
|
2979
|
-
|
|
2980
|
-
|
|
2979
|
+
let pageIndexChanged = this._updatePageCount();
|
|
2980
|
+
let sorted = this._sort();
|
|
2981
2981
|
if(sorted) {
|
|
2982
2982
|
e["globalChange"] = true; // Notify parent
|
|
2983
2983
|
}
|
|
@@ -3017,12 +3017,12 @@ DataView.prototype._onRowRemoved = function(e) { // onRemove
|
|
|
3017
3017
|
return 1; // may not be a correct number
|
|
3018
3018
|
}
|
|
3019
3019
|
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3020
|
+
let removeCount = 0;
|
|
3021
|
+
let rids = e["rids"];
|
|
3022
|
+
let i;
|
|
3023
3023
|
if(this._groupMembers) {
|
|
3024
|
-
|
|
3025
|
-
|
|
3024
|
+
let rowData = e["rowData"];
|
|
3025
|
+
let groupIds, groupId;
|
|
3026
3026
|
if(!rids && rowData) {
|
|
3027
3027
|
groupIds = this._resolveGroupId(rowData);
|
|
3028
3028
|
for(i = 0; i < groupIds.length; i++) {
|
|
@@ -3038,7 +3038,7 @@ DataView.prototype._onRowRemoved = function(e) { // onRemove
|
|
|
3038
3038
|
this._groupViewDirty = true;
|
|
3039
3039
|
}
|
|
3040
3040
|
} else {
|
|
3041
|
-
|
|
3041
|
+
let len = this._groupList.length;
|
|
3042
3042
|
for(i = 0; i < len; ++i) {
|
|
3043
3043
|
groupId = this._groupList[i];
|
|
3044
3044
|
removeCount += this._groupMembers[groupId]._onRowRemoved(e);
|
|
@@ -3046,9 +3046,9 @@ DataView.prototype._onRowRemoved = function(e) { // onRemove
|
|
|
3046
3046
|
}
|
|
3047
3047
|
}
|
|
3048
3048
|
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3049
|
+
let firstModifiedIndex = NaN;
|
|
3050
|
+
let removedRids = null;
|
|
3051
|
+
let rid, at;
|
|
3052
3052
|
|
|
3053
3053
|
// TODO: Change removal mechanism to object map based logic to speed up the process
|
|
3054
3054
|
removeCount = 0;
|
|
@@ -3076,7 +3076,7 @@ DataView.prototype._onRowRemoved = function(e) { // onRemove
|
|
|
3076
3076
|
}
|
|
3077
3077
|
if(removeCount > 0) {
|
|
3078
3078
|
// No sorting is required, since no order should be changed during the removal
|
|
3079
|
-
|
|
3079
|
+
let pageIndexChanged = this._updatePageCount();
|
|
3080
3080
|
if(pageIndexChanged || this._transformView(firstModifiedIndex)) {
|
|
3081
3081
|
this._dispatchGlobalChange();
|
|
3082
3082
|
} else {
|
|
@@ -3098,9 +3098,9 @@ DataView.prototype._onRowRemoved = function(e) { // onRemove
|
|
|
3098
3098
|
* @return {number}
|
|
3099
3099
|
*/
|
|
3100
3100
|
DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3101
|
+
let rid = e["rid"];
|
|
3102
|
+
let rowData = e["rowData"];
|
|
3103
|
+
let i, gid;
|
|
3104
3104
|
if(this.isRowFiltered(rid, rowData)) { // The row is qualified but it is filtered out
|
|
3105
3105
|
if(this._onRowRemoved(e)) {
|
|
3106
3106
|
return 1;
|
|
@@ -3109,8 +3109,8 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
|
3109
3109
|
}
|
|
3110
3110
|
|
|
3111
3111
|
if(this._groupMembers) {
|
|
3112
|
-
|
|
3113
|
-
|
|
3112
|
+
let flags = [];
|
|
3113
|
+
let len = this._groupList.length;
|
|
3114
3114
|
for(i = 0; i < len; ++i) {
|
|
3115
3115
|
gid = this._groupList[i];
|
|
3116
3116
|
flags[this._groupMembers[gid]._onRowUpdated(e)] = true;
|
|
@@ -3121,7 +3121,7 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
|
3121
3121
|
}
|
|
3122
3122
|
|
|
3123
3123
|
// conclude flag
|
|
3124
|
-
|
|
3124
|
+
let processingFlag = 0;
|
|
3125
3125
|
if(flags[2]) {
|
|
3126
3126
|
processingFlag = 2;
|
|
3127
3127
|
} else if(flags[1]) {
|
|
@@ -3150,7 +3150,7 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
|
3150
3150
|
|
|
3151
3151
|
this._groupViewDirty = true; // Adding row to sub-group both single and multiple-group require parent group to rebuild rows
|
|
3152
3152
|
|
|
3153
|
-
|
|
3153
|
+
let groupLen = this._resolveGroupId(rowData).length;
|
|
3154
3154
|
if(groupLen > 1) {
|
|
3155
3155
|
// activate multi-group row mode
|
|
3156
3156
|
this._shared.multiGroupRow = true;
|
|
@@ -3158,17 +3158,17 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
|
3158
3158
|
}
|
|
3159
3159
|
}
|
|
3160
3160
|
} else { // This is the root node
|
|
3161
|
-
|
|
3161
|
+
let noNewGroup = (flags[1] && flags[2]) || flags[4];
|
|
3162
3162
|
if(this._shared.multiGroupRow || !noNewGroup) {
|
|
3163
3163
|
// 0 - updated data from non-existing group to new group
|
|
3164
3164
|
// 1 - updated data from existing group to new group
|
|
3165
3165
|
// 2 - updated data from a non-existing group to existing group
|
|
3166
3166
|
// 3 - updated data from a existing group to another existing group
|
|
3167
3167
|
// 4 - updated data with in a single group and no group member changed
|
|
3168
|
-
|
|
3168
|
+
let gids = this._resolveGroupId(rowData);
|
|
3169
3169
|
for(i = 0; i < gids.length; i++) {
|
|
3170
3170
|
gid = gids[i];
|
|
3171
|
-
|
|
3171
|
+
let member = this._addGroup(gid); // Add header row
|
|
3172
3172
|
if(member) {
|
|
3173
3173
|
member._onRowInserted(e);
|
|
3174
3174
|
processingFlag = 1;
|
|
@@ -3196,7 +3196,7 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
|
3196
3196
|
|
|
3197
3197
|
// recursive task for leaf group
|
|
3198
3198
|
if(this._isAllowedInGroup(rid, rowData)) {
|
|
3199
|
-
|
|
3199
|
+
let newRowIndex = this._rids.indexOf(rid);
|
|
3200
3200
|
if(newRowIndex < 0) { // The row is qualified to be in the group, but not in the current view, so insert the row
|
|
3201
3201
|
this._onRowInserted(e);
|
|
3202
3202
|
return 2;
|
|
@@ -3223,8 +3223,8 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
|
3223
3223
|
*/
|
|
3224
3224
|
DataView.prototype._onGroupAdded = function(e) {
|
|
3225
3225
|
if(!this._hidden) {
|
|
3226
|
-
|
|
3227
|
-
|
|
3226
|
+
let newGroup = /** @type{DataView} */(e["newGroup"]);
|
|
3227
|
+
let rid = newGroup.getGroupRowId();
|
|
3228
3228
|
this._groupView.push(rid); // Add header row
|
|
3229
3229
|
this._groupViewDirty = true;
|
|
3230
3230
|
this._dispatch("groupAdded", e);
|
|
@@ -3278,7 +3278,7 @@ DataView.prototype._onRefreshTimeout = function() {
|
|
|
3278
3278
|
* @return {number}
|
|
3279
3279
|
*/
|
|
3280
3280
|
DataView.prototype._addDataRow = function(rid, opt_nextRid, opt_fallback) {
|
|
3281
|
-
|
|
3281
|
+
let rowIndex = this._getRowIndex(this._rids, opt_nextRid, opt_fallback);
|
|
3282
3282
|
this._insertItems(this._rids, rowIndex, rid);
|
|
3283
3283
|
if(this._groupView) {
|
|
3284
3284
|
if(this._groupMembers) {
|
|
@@ -3320,7 +3320,7 @@ DataView.prototype._getRowIndex = function(rids, opt_nextRid, opt_fallback) {
|
|
|
3320
3320
|
return -1;
|
|
3321
3321
|
}
|
|
3322
3322
|
|
|
3323
|
-
|
|
3323
|
+
let rowIndex = this._rids.indexOf(opt_nextRid);
|
|
3324
3324
|
if(rowIndex >= 0) {
|
|
3325
3325
|
return rowIndex;
|
|
3326
3326
|
}
|
|
@@ -3336,7 +3336,7 @@ DataView.prototype._getRowIndex = function(rids, opt_nextRid, opt_fallback) {
|
|
|
3336
3336
|
* @returns {number}
|
|
3337
3337
|
*/
|
|
3338
3338
|
DataView.prototype._removeDataRow = function(rid) {
|
|
3339
|
-
|
|
3339
|
+
let at = DataView._removeArrayItem(this._rids, rid);
|
|
3340
3340
|
if(this._groupView && at >= 0) {
|
|
3341
3341
|
at = DataView._removeArrayItem(this._groupView, rid);
|
|
3342
3342
|
}
|
|
@@ -3348,7 +3348,7 @@ DataView.prototype._removeDataRow = function(rid) {
|
|
|
3348
3348
|
* @return {number} Index of the removed item
|
|
3349
3349
|
*/
|
|
3350
3350
|
DataView._removeArrayItem = function(ary, item) {
|
|
3351
|
-
|
|
3351
|
+
let at = ary.indexOf(item);
|
|
3352
3352
|
if(at >= 0) {
|
|
3353
3353
|
ary.splice(at, 1);
|
|
3354
3354
|
}
|
|
@@ -3361,9 +3361,9 @@ DataView._removeArrayItem = function(ary, item) {
|
|
|
3361
3361
|
* @return {number} First item index that is being removed. NaN if no item is removed
|
|
3362
3362
|
*/
|
|
3363
3363
|
DataView._removeArrayItems = function(ary, items) {
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
for(
|
|
3364
|
+
let f = NaN;
|
|
3365
|
+
let c = 0;
|
|
3366
|
+
for(let i = ary.length; --i >= 0;) {
|
|
3367
3367
|
if (items[ary[i]]) {
|
|
3368
3368
|
++c;
|
|
3369
3369
|
} else if(c) {
|
|
@@ -3385,9 +3385,9 @@ DataView._removeArrayItems = function(ary, items) {
|
|
|
3385
3385
|
*/
|
|
3386
3386
|
DataView._copyObjectKeys = function(baseObj, masterObj) {
|
|
3387
3387
|
if(masterObj) {
|
|
3388
|
-
|
|
3388
|
+
let count = 0;
|
|
3389
3389
|
|
|
3390
|
-
for(
|
|
3390
|
+
for(let key in masterObj) {
|
|
3391
3391
|
baseObj[key] = 1;
|
|
3392
3392
|
++count; // WARNING: duplicated key can be counted more than once
|
|
3393
3393
|
}
|
|
@@ -3404,8 +3404,8 @@ DataView._copyObjectKeys = function(baseObj, masterObj) {
|
|
|
3404
3404
|
DataView.prototype._isAllowedInGroup = function(rid, rowData) {
|
|
3405
3405
|
// Check if it the row is belong to this group branch
|
|
3406
3406
|
if(this._groupLevel > 0) {
|
|
3407
|
-
|
|
3408
|
-
for(
|
|
3407
|
+
let dv = this;
|
|
3408
|
+
for(let i = this._groupLevel; --i >= 0;) {
|
|
3409
3409
|
if(!dv._groupFilterLogic(rid, rowData)) {
|
|
3410
3410
|
return false;
|
|
3411
3411
|
}
|
|
@@ -3455,10 +3455,10 @@ DataView.prototype._sort = function() {
|
|
|
3455
3455
|
}
|
|
3456
3456
|
|
|
3457
3457
|
if(this._dt._getSegmentSeparators() || this.isSorting()) {
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3458
|
+
let rids = this._rids;
|
|
3459
|
+
let dataRows = this._dt.getMultipleRowData(rids);
|
|
3460
|
+
let segmentValues = this._dt.getSegmentValues(rids, true); // WARNING: This does not work well for hidden/filtered rows
|
|
3461
|
+
let change = DataTable._performMultiLevelSorting(dataRows, this._sortingDefs, segmentValues);
|
|
3462
3462
|
|
|
3463
3463
|
if(change) {
|
|
3464
3464
|
this._rids = DataTable._reorderItems(rids, change); // Group view should be changed after this
|
|
@@ -3489,11 +3489,11 @@ DataView.prototype._getRemovalMap = function(removalMap, checker, filteringOut,
|
|
|
3489
3489
|
return 0;
|
|
3490
3490
|
}
|
|
3491
3491
|
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3492
|
+
let rids = this._rids; // Make local variable to speed up the process
|
|
3493
|
+
let dt = this._dt;
|
|
3494
|
+
let count = 0;
|
|
3495
|
+
let rid, i, values;
|
|
3496
|
+
let len = rids.length;
|
|
3497
3497
|
|
|
3498
3498
|
if(exceptions) {
|
|
3499
3499
|
for(i = len; --i >= 0;) {
|
|
@@ -3534,14 +3534,14 @@ DataView.prototype._getRemovalMap = function(removalMap, checker, filteringOut,
|
|
|
3534
3534
|
* @returns {number} Number of rids that would be filtered out
|
|
3535
3535
|
*/
|
|
3536
3536
|
DataView.prototype._getEmptySegments = function(removalMap, segmentRids) {
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
for(
|
|
3540
|
-
|
|
3537
|
+
let segments = this._dt._getSegmentSeparators();
|
|
3538
|
+
let count = 0;
|
|
3539
|
+
for(let segmentId in segmentRids) {
|
|
3540
|
+
let segment = segments.getSegment(segmentId);
|
|
3541
3541
|
if(segment) {
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
for(
|
|
3542
|
+
let chdr = segment.getChildren();
|
|
3543
|
+
let emptySegment = true;
|
|
3544
|
+
for(let childId in chdr) {
|
|
3545
3545
|
if(!removalMap[childId]) {
|
|
3546
3546
|
emptySegment = false;
|
|
3547
3547
|
break;
|
|
@@ -3603,23 +3603,23 @@ DataView.prototype._setPage = function (pageIndex) {
|
|
|
3603
3603
|
* @return {boolean} Return true if there is any change, otherwise false
|
|
3604
3604
|
*/
|
|
3605
3605
|
DataView.prototype._updatePaginationView = function(firstChange) {
|
|
3606
|
-
|
|
3606
|
+
let dirty = false;
|
|
3607
3607
|
if(this._pageView) {
|
|
3608
3608
|
if(!firstChange) { firstChange = 0; }
|
|
3609
3609
|
|
|
3610
|
-
|
|
3610
|
+
let pageStart = this._pageSize * (this._pageIndex - 1);
|
|
3611
3611
|
|
|
3612
|
-
|
|
3612
|
+
let pageEnd = this._pageSize + pageStart;
|
|
3613
3613
|
if(firstChange < pageEnd) { // The change happens before current page
|
|
3614
|
-
|
|
3614
|
+
let rids = this._groupView || this._rids;
|
|
3615
3615
|
if (pageEnd > rids.length) { // Shrink view if the last page is not a full page
|
|
3616
3616
|
pageEnd = rids.length;
|
|
3617
3617
|
}
|
|
3618
3618
|
|
|
3619
3619
|
// Populate the page
|
|
3620
|
-
|
|
3620
|
+
let ridsLen = pageEnd - pageStart;
|
|
3621
3621
|
this._pageView.length = (ridsLen >= 0) ? ridsLen : 0;
|
|
3622
|
-
for(
|
|
3622
|
+
for(let i = pageStart; i < pageEnd; ++i) {
|
|
3623
3623
|
this._pageView[i - pageStart] = rids[i];
|
|
3624
3624
|
}
|
|
3625
3625
|
dirty = true;
|
|
@@ -3635,10 +3635,10 @@ DataView.prototype._updatePaginationView = function(firstChange) {
|
|
|
3635
3635
|
* @fires DataView#pageIndexChanged
|
|
3636
3636
|
*/
|
|
3637
3637
|
DataView.prototype._updatePageCount = function () {
|
|
3638
|
-
|
|
3638
|
+
let lastPageIndex = 1;
|
|
3639
3639
|
if (this._pageSize > 0) {
|
|
3640
|
-
|
|
3641
|
-
|
|
3640
|
+
let rows = this._groupView || this._rids;
|
|
3641
|
+
let rowCount = (rows.length > 0) ? rows.length : 0;
|
|
3642
3642
|
lastPageIndex = Math.ceil(rowCount / this._pageSize);
|
|
3643
3643
|
}
|
|
3644
3644
|
if(this._lastPageIndex !== lastPageIndex) {
|
|
@@ -3665,7 +3665,7 @@ DataView.prototype._dispatchRowRemoved = function(rid) {
|
|
|
3665
3665
|
*/
|
|
3666
3666
|
DataView.prototype._dispatchMultiRowRemoved = function(rids) {
|
|
3667
3667
|
if(rids) {
|
|
3668
|
-
|
|
3668
|
+
let count = rids.length;
|
|
3669
3669
|
if(count === 1) {
|
|
3670
3670
|
this._dispatchRowRemoved(rids[0]);
|
|
3671
3671
|
} else if(count > 1) {
|
|
@@ -3704,11 +3704,11 @@ DataView.prototype._setParent = function (source) {
|
|
|
3704
3704
|
if(this._parent && this._dt !== this._parent) { // Copy shared member from parent data view
|
|
3705
3705
|
this._shared = this._parent._shared;
|
|
3706
3706
|
|
|
3707
|
-
|
|
3707
|
+
let cids = this._parent._columnStats;
|
|
3708
3708
|
if(cids) {
|
|
3709
|
-
for(
|
|
3710
|
-
|
|
3711
|
-
|
|
3709
|
+
for(let cid in cids) {
|
|
3710
|
+
let cs = this.enableColumnStats(cid);
|
|
3711
|
+
let pcs = this._parent.getColumnStats(cid);
|
|
3712
3712
|
if(cs && pcs) {
|
|
3713
3713
|
cs.setColumnDataGetter(pcs.getColumnDataGetter());
|
|
3714
3714
|
}
|
|
@@ -3720,18 +3720,18 @@ DataView.prototype._setParent = function (source) {
|
|
|
3720
3720
|
/** @private
|
|
3721
3721
|
*/
|
|
3722
3722
|
DataView.prototype._populateGroups = function () {
|
|
3723
|
-
|
|
3724
|
-
|
|
3723
|
+
let initialRids = this._rids;
|
|
3724
|
+
let i, len, member;
|
|
3725
3725
|
this._rids = [];
|
|
3726
3726
|
|
|
3727
3727
|
// Collect members of each group from the available data
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3728
|
+
let groupId, groupIds, groupLen;
|
|
3729
|
+
let ridMap = {};
|
|
3730
|
+
let groupList = [];
|
|
3731
3731
|
len = initialRids.length;
|
|
3732
3732
|
for(i = 0; i < len; ++i) {
|
|
3733
|
-
|
|
3734
|
-
|
|
3733
|
+
let rid = initialRids[i];
|
|
3734
|
+
let rowData = this._dt.getRowData(rid);
|
|
3735
3735
|
if(rowData) {
|
|
3736
3736
|
groupIds = this._resolveGroupId(rowData);
|
|
3737
3737
|
groupLen = groupIds.length;
|
|
@@ -3739,9 +3739,9 @@ DataView.prototype._populateGroups = function () {
|
|
|
3739
3739
|
// activate multi-group row mode
|
|
3740
3740
|
this._shared.multiGroupRow = true;
|
|
3741
3741
|
}
|
|
3742
|
-
for(
|
|
3742
|
+
for(let j = 0; j < groupLen; j++) {
|
|
3743
3743
|
groupId = groupIds[j];
|
|
3744
|
-
|
|
3744
|
+
let groupedRids = ridMap[groupId];
|
|
3745
3745
|
if(groupedRids) {
|
|
3746
3746
|
groupedRids.push(rid);
|
|
3747
3747
|
} else {
|
|
@@ -3767,7 +3767,7 @@ DataView.prototype._populateGroups = function () {
|
|
|
3767
3767
|
}
|
|
3768
3768
|
}
|
|
3769
3769
|
// Remove any non existing predefined groups
|
|
3770
|
-
|
|
3770
|
+
let preDefGroups = null;
|
|
3771
3771
|
if(this._preDefGroups && this._groupLevel < this._preDefGroups.length) {
|
|
3772
3772
|
preDefGroups = this._preDefGroups[this._groupLevel];
|
|
3773
3773
|
}
|
|
@@ -3796,7 +3796,7 @@ DataView.prototype._populateGroups = function () {
|
|
|
3796
3796
|
if(preDefGroups) {
|
|
3797
3797
|
len = preDefGroups.length;
|
|
3798
3798
|
for(i = 0; i < len; ++i) {
|
|
3799
|
-
|
|
3799
|
+
let pdg = this._addGroup(preDefGroups[i]);
|
|
3800
3800
|
if(pdg) {
|
|
3801
3801
|
pdg._predefinedGroup = true;
|
|
3802
3802
|
}
|
|
@@ -3825,7 +3825,7 @@ DataView.prototype._populateGroups = function () {
|
|
|
3825
3825
|
* @param {string} groupId
|
|
3826
3826
|
*/
|
|
3827
3827
|
DataView.prototype._removeGroupMember = function (groupIndex, groupId) {
|
|
3828
|
-
|
|
3828
|
+
let member = this._groupMembers[groupId];
|
|
3829
3829
|
if(member) {
|
|
3830
3830
|
this._groupList.splice(groupIndex, 1);
|
|
3831
3831
|
delete this._groupMembers[groupId];
|
|
@@ -3839,7 +3839,7 @@ DataView.prototype._removeGroupMember = function (groupIndex, groupId) {
|
|
|
3839
3839
|
* @return {Array.<string>}
|
|
3840
3840
|
*/
|
|
3841
3841
|
DataView.prototype._defaultGroupCriteria = function(cid, values) {
|
|
3842
|
-
|
|
3842
|
+
let val = values[cid];
|
|
3843
3843
|
if(Array.isArray(val)) {
|
|
3844
3844
|
return val.map(function(data) { // TODO: this is very slow
|
|
3845
3845
|
return data + "";
|
|
@@ -3854,7 +3854,7 @@ DataView.prototype._defaultGroupCriteria = function(cid, values) {
|
|
|
3854
3854
|
* @return {boolean}
|
|
3855
3855
|
*/
|
|
3856
3856
|
DataView.prototype._groupFilterLogic = function(rid, values) {
|
|
3857
|
-
|
|
3857
|
+
let gids = this._groupCriteria[this._groupLevel - 1](values); // TODO: this is very slow
|
|
3858
3858
|
return gids.indexOf(this._groupId) >= 0;
|
|
3859
3859
|
};
|
|
3860
3860
|
|
|
@@ -3864,8 +3864,8 @@ DataView.prototype._groupFilterLogic = function(rid, values) {
|
|
|
3864
3864
|
* @return {number}
|
|
3865
3865
|
*/
|
|
3866
3866
|
DataView.prototype._internalGroupSortingLogic = function(strA, strB) {
|
|
3867
|
-
|
|
3868
|
-
|
|
3867
|
+
let dvA = this._groupMembers[strA];
|
|
3868
|
+
let dvB = this._groupMembers[strB];
|
|
3869
3869
|
|
|
3870
3870
|
return this._groupSortingLogic(strA, strB, dvA, dvB);
|
|
3871
3871
|
};
|
|
@@ -3875,18 +3875,18 @@ DataView.prototype._internalGroupSortingLogic = function(strA, strB) {
|
|
|
3875
3875
|
* @return {DataView} Newly added group member. If it already exists, this method returns null.
|
|
3876
3876
|
*/
|
|
3877
3877
|
DataView.prototype._addGroup = function (value) {
|
|
3878
|
-
|
|
3878
|
+
let groupId = value + "";
|
|
3879
3879
|
if(!groupId) {
|
|
3880
3880
|
// window.console.log("WARNING: Group Id cannot be an empty string");
|
|
3881
3881
|
return null;
|
|
3882
3882
|
}
|
|
3883
|
-
|
|
3883
|
+
let member = this._groupMembers[groupId];
|
|
3884
3884
|
if(member) {
|
|
3885
3885
|
return null;
|
|
3886
3886
|
}
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3887
|
+
let parentGrpRowId = this._groupRowId || "_grp";
|
|
3888
|
+
let newGrpRowId = parentGrpRowId + "_" + groupId;
|
|
3889
|
+
let arg;
|
|
3890
3890
|
if(this._hasListener("beforeGroupAdded")) {
|
|
3891
3891
|
arg = {
|
|
3892
3892
|
"dataView": this, // parent
|
|
@@ -3901,7 +3901,7 @@ DataView.prototype._addGroup = function (value) {
|
|
|
3901
3901
|
}
|
|
3902
3902
|
}
|
|
3903
3903
|
member = new DataView();
|
|
3904
|
-
|
|
3904
|
+
let collapsed = this._shared.defaultCollapse;
|
|
3905
3905
|
if(collapsed != null) {
|
|
3906
3906
|
member._collapsed = collapsed;
|
|
3907
3907
|
}
|
|
@@ -3980,10 +3980,10 @@ DataView.prototype._rebuildRowIdsFromChildren = function () {
|
|
|
3980
3980
|
this._rids.length = 0;
|
|
3981
3981
|
if(this._groupView) { this._groupView.length = 0; }
|
|
3982
3982
|
if(!this._hidden) {
|
|
3983
|
-
|
|
3984
|
-
for(
|
|
3985
|
-
|
|
3986
|
-
|
|
3983
|
+
let grpLen = this._groupList.length;
|
|
3984
|
+
for(let i = 0; i < grpLen; ++i) { // Re-distribute this object content to all of its group members
|
|
3985
|
+
let gid = this._groupList[i];
|
|
3986
|
+
let member = this._groupMembers[gid];
|
|
3987
3987
|
member._rebuildRowIdsFromChildren();
|
|
3988
3988
|
|
|
3989
3989
|
Util.pushArrayItems(this._rids, member._rids);
|
|
@@ -3993,7 +3993,7 @@ DataView.prototype._rebuildRowIdsFromChildren = function () {
|
|
|
3993
3993
|
this._groupView.push(member._groupRowId); // Add header row
|
|
3994
3994
|
}
|
|
3995
3995
|
if(!member._collapsed) { // WARNING: This gives different value from isCollapsed() method
|
|
3996
|
-
|
|
3996
|
+
let rids = member._getFirstHiddenRids() || member._groupView || member._rids;
|
|
3997
3997
|
Util.pushArrayItems(this._groupView, rids);
|
|
3998
3998
|
Util.pushArrayItems(this._groupView, member._footerRowIds);
|
|
3999
3999
|
}
|
|
@@ -4018,7 +4018,7 @@ DataView.prototype._resolveGroupId = function (rowData) {
|
|
|
4018
4018
|
/** @private
|
|
4019
4019
|
*/
|
|
4020
4020
|
DataView.prototype._markColumnStatsDirty = function() {
|
|
4021
|
-
for(
|
|
4021
|
+
for(let cid in this._columnStats) {
|
|
4022
4022
|
this._columnStats[cid].markDirty();
|
|
4023
4023
|
}
|
|
4024
4024
|
};
|