@refinitiv-ui/efx-grid 6.0.33 → 6.0.35
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.js +50 -40
- package/lib/core/dist/core.js +210 -38
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +27 -9
- package/lib/core/es6/data/DataView.d.ts +2 -0
- package/lib/core/es6/data/DataView.js +12 -1
- package/lib/core/es6/data/Segment.d.ts +2 -0
- package/lib/core/es6/data/Segment.js +16 -0
- package/lib/core/es6/data/SegmentCollection.d.ts +1 -3
- package/lib/core/es6/data/SegmentCollection.js +25 -18
- package/lib/core/es6/grid/Core.d.ts +12 -0
- package/lib/core/es6/grid/Core.js +64 -2
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +13 -7
- package/lib/grid/index.js +1 -1
- package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
- package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/grid/themes/halo/efx-grid.less +3 -1
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +766 -293
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +13 -8
- package/lib/rt-grid/es6/DataConnector.js +3 -2
- package/lib/rt-grid/es6/Grid.d.ts +3 -1
- package/lib/rt-grid/es6/Grid.js +148 -40
- package/lib/rt-grid/es6/RowDefSorter.d.ts +5 -5
- package/lib/rt-grid/es6/RowDefSorter.js +165 -71
- package/lib/rt-grid/es6/RowDefinition.d.ts +7 -2
- package/lib/rt-grid/es6/RowDefinition.js +48 -10
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
- package/lib/rt-grid/es6/SnapshotFiller.js +1 -11
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +66 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +38 -13
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +12 -5
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +128 -42
- package/lib/tr-grid-heat-map/es6/HeatMap.d.ts +3 -3
- package/lib/tr-grid-heat-map/es6/HeatMap.js +13 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +153 -17
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +3 -2
- package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +20 -20
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +37 -138
- package/lib/tr-grid-util/es6/CellPainter.d.ts +1 -1
- package/lib/tr-grid-util/es6/CellPainter.js +56 -55
- package/lib/tr-grid-util/es6/DragUI.js +7 -3
- package/lib/tr-grid-util/es6/FieldFormatter.js +6 -2
- package/lib/tr-grid-util/es6/NumberFormatter.js +23 -11
- package/lib/tr-grid-util/es6/Util.d.ts +3 -0
- package/lib/tr-grid-util/es6/Util.js +53 -0
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +36 -33
- package/lib/types/es6/ColumnStack.d.ts +2 -0
- package/lib/types/es6/ConditionalColoring.d.ts +12 -5
- package/lib/types/es6/Core/data/DataTable.d.ts +3 -1
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/Segment.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -3
- package/lib/types/es6/Core/grid/Core.d.ts +4 -0
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +1 -0
- package/lib/types/es6/HeatMap.d.ts +3 -3
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +5 -5
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +7 -2
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +1 -0
- package/lib/types/es6/RowDragging.d.ts +2 -1
- package/lib/types/es6/TextFormatting.d.ts +20 -20
- package/lib/versions.json +9 -9
- package/package.json +1 -1
@@ -579,7 +579,7 @@ ColumnDefinition.prototype.getAllFields = function() {
|
|
579
579
|
* @return {boolean}
|
580
580
|
*/
|
581
581
|
ColumnDefinition.prototype.isRealTimeField = function() {
|
582
|
-
return FieldDefinition.isRealTimeField(this.getField());
|
582
|
+
return FieldDefinition.isRealTimeField(this.getField() || this._field);
|
583
583
|
};
|
584
584
|
/** @public
|
585
585
|
* @return {boolean}
|
@@ -770,8 +770,9 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
770
770
|
obj["sort"] = this._initialOrder;
|
771
771
|
}
|
772
772
|
|
773
|
-
|
774
|
-
|
773
|
+
var classes = this._classes;
|
774
|
+
if(classes && classes.length > 0) {
|
775
|
+
obj["className"] = classes.join(" ");
|
775
776
|
}
|
776
777
|
|
777
778
|
if(this._textSelect) {
|
@@ -789,14 +790,18 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
|
|
789
790
|
var core = this._eventArg["core"];
|
790
791
|
var grid = this._eventArg["grid"];
|
791
792
|
var colIndex = grid.getColumnIndex(this);
|
792
|
-
value = core.getColumnScalability(colIndex);
|
793
|
-
obj["scalable"] = value;
|
794
793
|
|
795
|
-
|
796
|
-
|
794
|
+
// The scalable, width and minWidth cannot be shifted into core as getConfigObject is accessible from colDef.
|
795
|
+
var scalable = core.getColumnScalability(colIndex);
|
796
|
+
var width = core.getColumnCustomLaneSize(colIndex);
|
797
|
+
|
798
|
+
if (scalable !== true || width !== 1) {
|
799
|
+
obj["scalable"] = scalable;
|
800
|
+
obj["width"] = width;
|
801
|
+
}
|
797
802
|
|
798
803
|
value = core.getMinimumColumnWidth(colIndex);
|
799
|
-
if(value !==
|
804
|
+
if(value !== 0) {
|
800
805
|
obj["minWidth"] = value;
|
801
806
|
}
|
802
807
|
|
@@ -85,7 +85,7 @@ DataConnector.prototype.getRowDefByRic = function (ric) {
|
|
85
85
|
* @return {boolean} True if new reference is added.
|
86
86
|
*/
|
87
87
|
DataConnector.prototype.addRic = function (rowDef) {
|
88
|
-
var ric = rowDef ? rowDef.
|
88
|
+
var ric = rowDef ? rowDef.getSymbol() : "";
|
89
89
|
if(!ric) {
|
90
90
|
return false;
|
91
91
|
}
|
@@ -113,7 +113,8 @@ DataConnector.prototype.addRic = function (rowDef) {
|
|
113
113
|
*/
|
114
114
|
DataConnector.prototype.removeRic = function (rowDef, ric) {
|
115
115
|
if(!ric) {
|
116
|
-
|
116
|
+
// TODO: RIC or permId maybe change during run-time, need to check before remove RIC/permId
|
117
|
+
ric = rowDef ? rowDef.getSymbol() : "";
|
117
118
|
}
|
118
119
|
if(!ric) {
|
119
120
|
return;
|
@@ -3,7 +3,7 @@ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
|
|
3
3
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
4
4
|
import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
|
5
5
|
import { Engine } from "../../tr-grid-util/es6/formula/Engine.js";
|
6
|
-
import { cloneObject, extendObject, arrayToObject } from "../../tr-grid-util/es6/Util.js";
|
6
|
+
import { cloneObject, extendObject, arrayToObject, isEmptyObject, deepEqual } from "../../tr-grid-util/es6/Util.js";
|
7
7
|
import { DateTime } from "../../tr-grid-util/es6/DateTime.js";
|
8
8
|
|
9
9
|
import { RowDefinition, ROW_DEF } from "./RowDefinition.js";
|
@@ -134,6 +134,8 @@ declare class Grid extends EventDispatcher {
|
|
134
134
|
|
135
135
|
public setColumns(columns: (any)[]|null): void;
|
136
136
|
|
137
|
+
public restoreColumns(columns: (any)[]|null): void;
|
138
|
+
|
137
139
|
public setFields(ary: (string)[]|null): void;
|
138
140
|
|
139
141
|
public removeColumn(colRef: Grid.ColumnReference|null): void;
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -4,7 +4,7 @@ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
|
|
4
4
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
5
5
|
import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
|
6
6
|
import { Engine } from "../../tr-grid-util/es6/formula/Engine.js";
|
7
|
-
import { cloneObject, extendObject, arrayToObject } from "../../tr-grid-util/es6/Util.js";
|
7
|
+
import { cloneObject, extendObject, arrayToObject, isEmptyObject, deepEqual } from "../../tr-grid-util/es6/Util.js";
|
8
8
|
import { DateTime } from "../../tr-grid-util/es6/DateTime.js";
|
9
9
|
|
10
10
|
import { RowDefinition, ROW_DEF } from "./RowDefinition.js";
|
@@ -1062,6 +1062,28 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1062
1062
|
grid.getConfigObject(obj);
|
1063
1063
|
}
|
1064
1064
|
|
1065
|
+
// Difference from composite grid in default config
|
1066
|
+
if(obj["columnVirtualization"] === false) {
|
1067
|
+
delete obj["columnVirtualization"];
|
1068
|
+
}
|
1069
|
+
|
1070
|
+
if(obj["rowVirtualization"] === true) {
|
1071
|
+
delete obj["rowVirtualization"];
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
if(obj["rowHighlighting"] === true) {
|
1075
|
+
delete obj["rowHighlighting"];
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
if(obj["contentVerticalLines"] === false) { // the default value change in wrapper (atlas-blotter)
|
1079
|
+
delete obj["contentVerticalLines"];
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
if(obj["borders"] === false) { // the default value change in wrapper (atlas-blotter)
|
1083
|
+
delete obj["borders"];
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
|
1065
1087
|
var i, len;
|
1066
1088
|
len = this.getColumnCount();
|
1067
1089
|
for (i = 0; i < len; ++i) {
|
@@ -1086,12 +1108,12 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1086
1108
|
}
|
1087
1109
|
|
1088
1110
|
val = grid.getDefaultRowHeight();
|
1089
|
-
if(val !==
|
1111
|
+
if(val !== 28) { // the default value change in wrapper (atlas-blotter)
|
1090
1112
|
obj["rowHeight"] = val;
|
1091
1113
|
}
|
1092
1114
|
|
1093
1115
|
val = grid.getSection("title").getDefaultRowHeight();
|
1094
|
-
if(val !==
|
1116
|
+
if(val !== 28) { // the default value change in wrapper (atlas-blotter)
|
1095
1117
|
obj["headerRowHeight"] = val;
|
1096
1118
|
}
|
1097
1119
|
|
@@ -1099,7 +1121,8 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1099
1121
|
obj["autoLayoutUpdate"] = true;
|
1100
1122
|
}
|
1101
1123
|
|
1102
|
-
|
1124
|
+
val = isEmptyObject(this._defaultColumnOptions);
|
1125
|
+
if (!val) { // Currently, this variable is the object, we need to check empty array for default value
|
1103
1126
|
obj["defaultColumnOptions"] = this._defaultColumnOptions;
|
1104
1127
|
}
|
1105
1128
|
|
@@ -1158,10 +1181,13 @@ Grid.prototype.getConfigObject = function (gridOptions) {
|
|
1158
1181
|
}
|
1159
1182
|
|
1160
1183
|
// TODO: The following states need to be retrieved
|
1161
|
-
// rowHighlighting
|
1162
|
-
// columnVirtualization
|
1163
1184
|
// topFreezingCount, bottomFreezingCount
|
1164
1185
|
// scrollbarParent
|
1186
|
+
// linearWheelScrolling
|
1187
|
+
// stepScroll
|
1188
|
+
// noColumnDragging
|
1189
|
+
// columnReorder
|
1190
|
+
// topSection
|
1165
1191
|
|
1166
1192
|
// NOTE: no need to export synapseApiKey, ADC and RTK
|
1167
1193
|
|
@@ -1237,7 +1263,7 @@ Grid.prototype._onRicAdded = function(e) {
|
|
1237
1263
|
var jLen = rowDefs ? rowDefs.length : 0;
|
1238
1264
|
for (var j = 0; j < jLen; ++j) {
|
1239
1265
|
var rowDef = rowDefs[j];
|
1240
|
-
if (rowDef.
|
1266
|
+
if (rowDef.getSymbol() === ric) {
|
1241
1267
|
this._snapshot.addRic(ric); // ADC
|
1242
1268
|
}
|
1243
1269
|
}
|
@@ -1262,7 +1288,7 @@ Grid.prototype._onFieldAdded = function(e) {
|
|
1262
1288
|
|
1263
1289
|
// ADC
|
1264
1290
|
for (var i in rowDefs) {
|
1265
|
-
this._snapshot.addRic(rowDefs[i].
|
1291
|
+
this._snapshot.addRic(rowDefs[i].getSymbol());
|
1266
1292
|
}
|
1267
1293
|
this._snapshot.addFields(addedFields);
|
1268
1294
|
|
@@ -1456,7 +1482,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
1456
1482
|
colConfig["width"] = value;
|
1457
1483
|
|
1458
1484
|
value = core.getMinimumColumnWidth(colIndex);
|
1459
|
-
if(value
|
1485
|
+
if(value > 0) {
|
1460
1486
|
colConfig["minWidth"] = value;
|
1461
1487
|
}
|
1462
1488
|
|
@@ -1594,22 +1620,101 @@ Grid.prototype._shouldLoadFieldInfo = function (field) {
|
|
1594
1620
|
* @param {Array.<Object>} columns Array of column options
|
1595
1621
|
*/
|
1596
1622
|
Grid.prototype.setColumns = function(columns) {
|
1623
|
+
var grid = this._grid;
|
1597
1624
|
var colCount = (columns) ? columns.length : 0;
|
1598
1625
|
|
1626
|
+
grid.startBatch("reset");
|
1599
1627
|
this.removeAllColumns();
|
1600
1628
|
if(colCount > 0) {
|
1601
1629
|
var prevState = false;
|
1602
1630
|
if(colCount > 1) {
|
1603
|
-
prevState =
|
1631
|
+
prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
1604
1632
|
}
|
1605
1633
|
for(var i = 0; i < colCount; ++i) {
|
1606
1634
|
this.insertColumn(columns[i], i);
|
1607
1635
|
}
|
1608
1636
|
if(colCount > 1) {
|
1609
|
-
|
1637
|
+
grid.freezeLayout(prevState);
|
1610
1638
|
}
|
1611
1639
|
}
|
1640
|
+
grid.stopBatch("reset");
|
1612
1641
|
};
|
1642
|
+
|
1643
|
+
|
1644
|
+
/** Remove, add and keep column based on the given column data
|
1645
|
+
* @public
|
1646
|
+
* @param {Array.<Object>} columns Array of column options
|
1647
|
+
*/
|
1648
|
+
Grid.prototype.restoreColumns = function(columns) {
|
1649
|
+
var grid = this._grid;
|
1650
|
+
grid.startBatch("reset");
|
1651
|
+
var configObj = this.getConfigObject();
|
1652
|
+
var previousColumns = configObj.columns;
|
1653
|
+
|
1654
|
+
var preColLen = previousColumns.length;
|
1655
|
+
var newColLen = columns.length;
|
1656
|
+
|
1657
|
+
var removingFields = [];
|
1658
|
+
var keepingColumns = [];
|
1659
|
+
var columnOrdering = [];
|
1660
|
+
|
1661
|
+
var i, j, found;
|
1662
|
+
// Slow, time complexity BigO(n ^ 2)
|
1663
|
+
for (i = 0; i < preColLen; i++) {
|
1664
|
+
found = false;
|
1665
|
+
for (j = 0; j < newColLen; j++) {
|
1666
|
+
if (deepEqual(previousColumns[i], columns[j])) {
|
1667
|
+
keepingColumns.push(previousColumns[i]);
|
1668
|
+
found = true;
|
1669
|
+
break;
|
1670
|
+
}
|
1671
|
+
}
|
1672
|
+
if (!found) {
|
1673
|
+
removingFields.push(previousColumns[i].field);
|
1674
|
+
}
|
1675
|
+
}
|
1676
|
+
|
1677
|
+
var sortingStates;
|
1678
|
+
var removeLen = removingFields.length;
|
1679
|
+
if(removeLen > 0 && this._stp) {
|
1680
|
+
sortingStates = this._stp.getSortingStates().slice(); // We need to clone array for avoid object reference in remove column
|
1681
|
+
}
|
1682
|
+
|
1683
|
+
this.removeColumns(removingFields);
|
1684
|
+
|
1685
|
+
var keepingLen = keepingColumns.length;
|
1686
|
+
var prevState = false;
|
1687
|
+
if(newColLen > 1) {
|
1688
|
+
prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
1689
|
+
}
|
1690
|
+
for (i = 0; i < newColLen; i++) {
|
1691
|
+
found = false;
|
1692
|
+
for (j = 0; j < keepingLen; j++) { // loop only keeping column
|
1693
|
+
if (deepEqual(columns[i], keepingColumns[j])) {
|
1694
|
+
found = true;
|
1695
|
+
var colIndex = this.getColumnIndex(columns[i].field); // We cannot use 'i' (colIndex) in this case, as it will sort the columns. Instead, we need to obtain a new column index from the field.
|
1696
|
+
columnOrdering.push(this.getColumnId(colIndex));
|
1697
|
+
break;
|
1698
|
+
}
|
1699
|
+
}
|
1700
|
+
if (!found) {
|
1701
|
+
this.insertColumn(columns[i], i);
|
1702
|
+
columnOrdering.push(this.getColumnId(i)); // Use new insertion column index
|
1703
|
+
}
|
1704
|
+
}
|
1705
|
+
|
1706
|
+
if(newColLen > 1) {
|
1707
|
+
this._grid.freezeLayout(prevState);
|
1708
|
+
}
|
1709
|
+
|
1710
|
+
if(removeLen > 0 && this._stp) {
|
1711
|
+
this._stp.sortColumns(sortingStates);
|
1712
|
+
}
|
1713
|
+
|
1714
|
+
grid.reorderColumns(columnOrdering);
|
1715
|
+
grid.stopBatch("reset");
|
1716
|
+
};
|
1717
|
+
|
1613
1718
|
/** Remove all existing columns and add new columns based on the given texts/fields
|
1614
1719
|
* @public
|
1615
1720
|
* @function
|
@@ -1754,10 +1859,11 @@ Grid.prototype.removeColumn = function(colRef) {
|
|
1754
1859
|
this._dc.removeStaticFields([colDef.getField()]);
|
1755
1860
|
}
|
1756
1861
|
}
|
1757
|
-
colDef.dispose();
|
1758
|
-
this._grid.removeColumnAt(colIndex);
|
1759
1862
|
|
1863
|
+
this._grid.removeColumnAt(colIndex);
|
1760
1864
|
this._connector.removeFields(colDef);
|
1865
|
+
|
1866
|
+
colDef.dispose(); // Dispose at the last line to avoid making properties inaccessible
|
1761
1867
|
// TODO: Remove fields that are related to the column (e.g. fields for coloring)
|
1762
1868
|
};
|
1763
1869
|
/** Remove multiple columns through array. To remove all columns, use removeAllColumns() instead of this method
|
@@ -2103,7 +2209,7 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
|
|
2103
2209
|
* @param {RowDefinition} rowDef
|
2104
2210
|
*/
|
2105
2211
|
Grid.prototype._initDuplicateRicData = function(rowDef) {
|
2106
|
-
var ric = rowDef.
|
2212
|
+
var ric = rowDef.getSymbol();
|
2107
2213
|
var rowDefs = this._connector.getRowDefByRic(ric);
|
2108
2214
|
if(rowDefs && rowDefs.length) {
|
2109
2215
|
cloneRowData(rowDefs[0], rowDef);
|
@@ -2520,8 +2626,9 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
2520
2626
|
this.insertRow(options, rowIndex);
|
2521
2627
|
}
|
2522
2628
|
} else {
|
2523
|
-
var oldRic = rowDef.
|
2524
|
-
|
2629
|
+
var oldRic = rowDef.getSymbol();
|
2630
|
+
var permId = options["permId"] || "";
|
2631
|
+
if(rowDef.setContent(str, permId)) { // The given string may not be a RIC
|
2525
2632
|
this._connector.removeRic(rowDef, oldRic);
|
2526
2633
|
this._initDuplicateRicData(rowDef);
|
2527
2634
|
this._connector.addRic(rowDef);
|
@@ -2842,7 +2949,7 @@ Grid.prototype.setRicData = function(ric, values) {
|
|
2842
2949
|
var rowCount = rowDefs ? rowDefs.length : 0;
|
2843
2950
|
for (var i = 0; i < rowCount; ++i) {
|
2844
2951
|
var rowDef = rowDefs[i];
|
2845
|
-
if (rowDef && rowDef.
|
2952
|
+
if (rowDef && rowDef.getSymbol() === ric) {
|
2846
2953
|
rowDef.setRowData(values); // TODO: Need conflator to improve performance
|
2847
2954
|
}
|
2848
2955
|
}
|
@@ -3298,33 +3405,34 @@ Grid.prototype._updateStreamingData = function() {
|
|
3298
3405
|
* @param {Object} e
|
3299
3406
|
*/
|
3300
3407
|
Grid.prototype._onPreDataSorting = function (e) {
|
3301
|
-
var
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
|
3307
|
-
|
3308
|
-
|
3309
|
-
|
3310
|
-
|
3311
|
-
|
3312
|
-
|
3313
|
-
|
3408
|
+
var objs = this._stp.getSortedColumns();
|
3409
|
+
|
3410
|
+
this._sorter.reset();
|
3411
|
+
if(Array.isArray(objs)) {
|
3412
|
+
var sortCount = objs.length;
|
3413
|
+
for(var i = 0; i < sortCount; ++i) {
|
3414
|
+
var obj = objs[i];
|
3415
|
+
var field = obj["field"] || "";
|
3416
|
+
var colIndex = obj["colIndex"];
|
3417
|
+
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
3418
|
+
|
3419
|
+
var rowSorting = false;
|
3420
|
+
var sortLogic = null;
|
3421
|
+
if(colDef) {
|
3422
|
+
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
3423
|
+
rowSorting = colDef.isRowSorting();
|
3424
|
+
sortLogic = colDef.getSorter();
|
3425
|
+
}
|
3426
|
+
// TODO: get sortLogic from DataView
|
3427
|
+
// if(!sortLogic && field) {
|
3428
|
+
// sortLogic = state["sortLogic"];
|
3429
|
+
// }
|
3314
3430
|
|
3315
|
-
|
3316
|
-
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
3317
|
-
sortLogic = colDef.getSorter();
|
3318
|
-
rowSorting = colDef.isRowSorting();
|
3431
|
+
this._sorter.addColumnContext(field, sortLogic, rowSorting, obj["sortOrder"], colIndex, colDef);
|
3319
3432
|
}
|
3320
3433
|
}
|
3321
|
-
if(!sortLogic && field) {
|
3322
|
-
sortLogic = state["sortLogic"];
|
3323
|
-
}
|
3324
3434
|
|
3325
|
-
this._sorter.
|
3326
|
-
this._sorter.setSortLogic(sortLogic);
|
3327
|
-
this._columnSorter = this._sorter.getSorter(rowSorting);
|
3435
|
+
this._columnSorter = this._sorter.getSorter();
|
3328
3436
|
};
|
3329
3437
|
/** @private
|
3330
3438
|
* @param {RowDefinition} rowDefA
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import { cloneObject } from "../../tr-grid-util/es6/Util.js";
|
2
2
|
|
3
3
|
declare class RowDefSorter {
|
4
4
|
|
@@ -6,14 +6,14 @@ declare class RowDefSorter {
|
|
6
6
|
|
7
7
|
public dispose(): void;
|
8
8
|
|
9
|
-
public getSorter(
|
10
|
-
|
11
|
-
public setSortLogic(func?: ((...params: any[]) => any)|null): void;
|
9
|
+
public getSorter(): ((...params: any[]) => any)|null;
|
12
10
|
|
13
|
-
public
|
11
|
+
public reset(key: string, value: any): void;
|
14
12
|
|
15
13
|
public setContext(key: string, value: any): void;
|
16
14
|
|
15
|
+
public addColumnContext(field: string, logic: ((...params: any[]) => any)|null, rowSorting: boolean, order: string, colIndex: number, colDef: any): void;
|
16
|
+
|
17
17
|
}
|
18
18
|
|
19
19
|
export default RowDefSorter;
|