@refinitiv-ui/efx-grid 6.0.21 → 6.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -528,7 +528,7 @@ Core.prototype._rowHeightTimerId = 0;
528
528
  * @return {string}
529
529
  */
530
530
  Core.getVersion = function () {
531
- return "5.1.31";
531
+ return "5.1.32";
532
532
  };
533
533
  /** {@link ElementWrapper#dispose}
534
534
  * @override
@@ -2880,6 +2880,13 @@ Core.prototype.freezeLayout = function (opt_bool) {
2880
2880
  if (prevState !== opt_bool) {
2881
2881
  this._frozenLayout = opt_bool;
2882
2882
 
2883
+ var stp = this.getPlugin("SortableTitlePlugin");
2884
+ if(this._frozenLayout) {
2885
+ if(stp) {
2886
+ stp.freezeIndicator(true);
2887
+ }
2888
+ }
2889
+
2883
2890
  if (!this._frozenLayout) {
2884
2891
  // Width has not yet changed so we need to disable it first
2885
2892
  this._disableEvent("widthChanged");
@@ -2908,6 +2915,9 @@ Core.prototype.freezeLayout = function (opt_bool) {
2908
2915
  if(!viewChanged) { // Always update virtualizer
2909
2916
  this._rowVirtualizer.update(true); // Force section activation
2910
2917
  }
2918
+ if(stp) {
2919
+ stp.freezeIndicator(false);
2920
+ }
2911
2921
  }
2912
2922
  this._rowHeightSync = true;
2913
2923
  }
@@ -1612,6 +1612,7 @@ LayoutGrid.prototype.setFrozenLayout = function (bool) {
1612
1612
  if (this._frozenLayout !== bool) {
1613
1613
  this._frozenLayout = bool;
1614
1614
 
1615
+ this._cellSpans.freezeMapping(this._frozenLayout);
1615
1616
  if (!this._frozenLayout) {
1616
1617
  this._syncLayoutToColumns(0);
1617
1618
  this._syncLayoutToRows(0, this._rowCount);
@@ -6,6 +6,8 @@ declare class CellSpans {
6
6
 
7
7
  public removeColumn(at: number): boolean;
8
8
 
9
+ public freezeMapping(bool?: boolean|null): void;
10
+
9
11
  public shiftColumn(from: number, amount: number): boolean;
10
12
 
11
13
  public removeSpan(indexX: number, indexY: number): CellSpan|null;
@@ -20,6 +20,33 @@ CellSpans.prototype.removeColumn = function (at) { // Use when a column is remov
20
20
  }
21
21
  return dirty;
22
22
  };
23
+ /** @public
24
+ * @param {boolean=} bool
25
+ */
26
+ CellSpans.prototype.freezeMapping = function (bool) {
27
+ this._frozenMapping = bool !== false;
28
+ if(!this._frozenMapping) {
29
+ this._mapCellSpans();
30
+ }
31
+ };
32
+
33
+
34
+ /** @private
35
+ */
36
+ CellSpans.prototype._mapCellSpans = function () {
37
+ var cellSpans = this._spans;
38
+ this._spans = [];
39
+ this._occupiedMap = {};
40
+ var i, cellSpan;
41
+ for(i = cellSpans.length; --i >= 0;) {
42
+ cellSpan = cellSpans[i];
43
+ if(cellSpan.indexX >= 0) {
44
+ cellSpan.register(this._spans, this._occupiedMap);
45
+ }
46
+ }
47
+ };
48
+
49
+
23
50
  /** @public
24
51
  * @param {number} from
25
52
  * @param {number} amount This can be negative number
@@ -36,18 +63,10 @@ CellSpans.prototype.shiftColumn = function (from, amount) { // Use when a column
36
63
  cellSpan.indexX += amount;
37
64
  }
38
65
  }
39
- if(!dirty) { return false; }
66
+ if(!dirty || this._frozenMapping) { return false; }
40
67
 
41
68
  // Re-registers all cellspans. Some of the cellspans may be lost due to shifting
42
- var cellSpans = this._spans;
43
- this._spans = [];
44
- this._occupiedMap = {};
45
- for(i = cellSpans.length; --i >= 0;) {
46
- cellSpan = cellSpans[i];
47
- if(cellSpan.indexX >= 0) {
48
- cellSpan.register(this._spans, this._occupiedMap);
49
- }
50
- }
69
+ this._mapCellSpans();
51
70
  return true;
52
71
  };
53
72
  /** @public
@@ -336,6 +355,12 @@ CellSpans.prototype._spans;
336
355
  */
337
356
  CellSpans.prototype._occupiedMap;
338
357
 
358
+ /**
359
+ * @private
360
+ * @type {boolean}
361
+ */
362
+ CellSpans.prototype._frozenMapping = false;
363
+
339
364
  export default CellSpans;
340
365
  export { CellSpans };
341
366
 
@@ -110,6 +110,8 @@ declare class SortableTitlePlugin extends EventDispatcher {
110
110
 
111
111
  public disableTwoStateSorting(disabled?: boolean|null): void;
112
112
 
113
+ public freezeIndicator(bool?: boolean|null): void;
114
+
113
115
  public disableSortSymbols(disabled?: boolean|null): void;
114
116
 
115
117
  public disableDataSorting(disabled?: boolean|null): void;
@@ -192,6 +192,10 @@ SortableTitlePlugin.prototype._userManagedLogic = false;
192
192
  * @type {boolean}
193
193
  */
194
194
  SortableTitlePlugin.prototype._disabled = false;
195
+ /** @private
196
+ * @type {boolean}
197
+ */
198
+ SortableTitlePlugin.prototype._frozenIndicator = false;
195
199
  /** Since DataView in real-time grid has only one ROW_DEF column, we need to re-map sorting field to sort correctly.
196
200
  * @private
197
201
  * @type {boolean}
@@ -750,8 +754,9 @@ SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
750
754
  * @param {Object=} opt_arg Event argument to be sent with preDataSorting event
751
755
  */
752
756
  SortableTitlePlugin.prototype.clearSortState = function (opt_arg) {
753
- this._popSortState(0, opt_arg);
754
- this.updateSortSymbols();
757
+ if(this._popSortState(0, opt_arg)) {
758
+ this.updateSortSymbols();
759
+ }
755
760
  };
756
761
  /** @description Perform sorting with the same parameter.
757
762
  * @public
@@ -956,6 +961,12 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
956
961
 
957
962
  };
958
963
  /** @public
964
+ * @param {boolean=} bool=true, if set to false it will be unfreeze indicator
965
+ */
966
+ SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
967
+ this._frozenIndicator = bool !== false;
968
+ };
969
+ /** @public
959
970
  * @param {boolean=} disabled
960
971
  */
961
972
  SortableTitlePlugin.prototype.disableSortSymbols = function (disabled) {
@@ -1568,7 +1579,7 @@ SortableTitlePlugin.prototype._clearSortSymbols = function (state) {
1568
1579
  SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
1569
1580
  var t = this;
1570
1581
  var host = t._hosts[hostIndex];
1571
- if (!host) { return; }
1582
+ if (!host || this._frozenIndicator) { return; }
1572
1583
 
1573
1584
  var section = host.getSection("title");
1574
1585
  if (section == null) { return; }
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.21" };
3
+ window.EFX_GRID = { version: "6.0.22" };
@@ -13094,6 +13094,10 @@ var RowDefinition = function(rowOptions) {
13094
13094
  * @private
13095
13095
  */
13096
13096
  RowDefinition._runningId = 0;
13097
+ /** @type {string}
13098
+ * @private
13099
+ */
13100
+ RowDefinition._childDataField = "CHILD_VALUES";
13097
13101
  //#region Private Members
13098
13102
  /** @type {string}
13099
13103
  * @private
@@ -13284,7 +13288,11 @@ RowDefinition.prototype._initializeAsConstituent = function(rowOptions) {
13284
13288
  }
13285
13289
  }
13286
13290
  }
13287
- // TODO: Allow constituent to have predefined static values
13291
+ var val = rowOptions["values"];
13292
+ // eslint-disable-next-line no-undefined
13293
+ if(val !== undefined) {
13294
+ this.setStaticRowData(val, rowOptions["fields"]);
13295
+ }
13288
13296
  };
13289
13297
  /** @public
13290
13298
  * @param {string} userInput
@@ -13356,11 +13364,6 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
13356
13364
  obj["ric"] = val;
13357
13365
  }
13358
13366
 
13359
- val = this._staticValues;
13360
- if(val) {
13361
- obj["values"] = Object(Util["b" /* cloneObject */])(val);
13362
- }
13363
-
13364
13367
  val = this._chainRic;
13365
13368
  if(val) {
13366
13369
  obj["chainRic"] = val;
@@ -13392,6 +13395,40 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
13392
13395
  obj["hidden"] = val;
13393
13396
  }
13394
13397
 
13398
+ val = this._getStaticRowData();
13399
+ if(val) {
13400
+ obj["values"] = val;
13401
+ }
13402
+
13403
+ // obtain the static values of constituent rows
13404
+ if(this.isChain()) {
13405
+ var children = this.getChildren();
13406
+ if(children) {
13407
+ var childValues = val ? val[RowDefinition._childDataField] : {};
13408
+ if(!childValues) {
13409
+ childValues = {};
13410
+ }
13411
+ var dirty = false;
13412
+ var len = children.length;
13413
+ var i, rowDef, staticValues;
13414
+ for(i = 0; i < len; i++) {
13415
+ rowDef = children[i];
13416
+ staticValues = rowDef._getStaticRowData();
13417
+ if(staticValues) {
13418
+ dirty = true;
13419
+ childValues[rowDef.getRic()] = staticValues;
13420
+ }
13421
+ }
13422
+
13423
+ if(dirty) {
13424
+ if(!obj["values"]) {
13425
+ obj["values"] = {};
13426
+ }
13427
+ obj["values"][RowDefinition._childDataField] = childValues;
13428
+ }
13429
+ }
13430
+ }
13431
+
13395
13432
  return obj;
13396
13433
  };
13397
13434
  /** Since an index chain (e.g. .FTSE) can automatically produce rows for its constituent, we need to separate rowId and dataId, so that the constituents still use the same data Id as that of its parent.
@@ -13466,6 +13503,12 @@ RowDefinition.prototype.setStaticRowData = function(data, opt_fields) {
13466
13503
  }
13467
13504
  };
13468
13505
  /** @public
13506
+ * @return {Object.<string, *>}
13507
+ */
13508
+ RowDefinition.prototype._getStaticRowData = function() {
13509
+ return this._staticValues ? Object(Util["b" /* cloneObject */])(this._staticValues) : null;
13510
+ };
13511
+ /** @public
13469
13512
  * @param {Object.<string, *>|Array} data
13470
13513
  * @param {Array.<string>=} opt_fields In case of the given data is an array, this param will be used for mapping index to field
13471
13514
  */
@@ -13766,6 +13809,22 @@ RowDefinition.deregisterFromView = function(rowIds, rowDef) {
13766
13809
  rowDef._deregisterFromView(rowIds);
13767
13810
  return rowIds;
13768
13811
  };
13812
+ /** @private
13813
+ * @param {string} ric
13814
+ * @return {Object}
13815
+ */
13816
+ RowDefinition.prototype._getChildStaticRowData = function(ric) {
13817
+ if(!this._staticValues) {
13818
+ return null;
13819
+ }
13820
+
13821
+ var childValues = this._staticValues[RowDefinition._childDataField];
13822
+ if(!childValues) {
13823
+ return null;
13824
+ }
13825
+
13826
+ return childValues[ric] || null;
13827
+ };
13769
13828
  /** @public
13770
13829
  * @ignore
13771
13830
  * @param {string} ric
@@ -13793,12 +13852,19 @@ RowDefinition.prototype.addConstituent = function(ric) {
13793
13852
 
13794
13853
  var newChild = !childDef;
13795
13854
  if(newChild) {
13796
- childDef = new RowDefinition({
13855
+ var rowOptions = {
13797
13856
  "asConstituent": true,
13798
13857
  "dataId": this._subId + ric,
13799
13858
  "ric": ric,
13800
13859
  "parent": this
13801
- });
13860
+ };
13861
+
13862
+ var staticData = this._getChildStaticRowData(ric);
13863
+ if(staticData) {
13864
+ rowOptions["values"] = staticData;
13865
+ }
13866
+
13867
+ childDef = new RowDefinition(rowOptions);
13802
13868
  }
13803
13869
 
13804
13870
  if(this._view) {
@@ -20516,6 +20582,33 @@ CellSpans.prototype.removeColumn = function (at) { // Use when a column is remov
20516
20582
  }
20517
20583
  return dirty;
20518
20584
  };
20585
+ /** @public
20586
+ * @param {boolean=} bool
20587
+ */
20588
+ CellSpans.prototype.freezeMapping = function (bool) {
20589
+ this._frozenMapping = bool !== false;
20590
+ if(!this._frozenMapping) {
20591
+ this._mapCellSpans();
20592
+ }
20593
+ };
20594
+
20595
+
20596
+ /** @private
20597
+ */
20598
+ CellSpans.prototype._mapCellSpans = function () {
20599
+ var cellSpans = this._spans;
20600
+ this._spans = [];
20601
+ this._occupiedMap = {};
20602
+ var i, cellSpan;
20603
+ for(i = cellSpans.length; --i >= 0;) {
20604
+ cellSpan = cellSpans[i];
20605
+ if(cellSpan.indexX >= 0) {
20606
+ cellSpan.register(this._spans, this._occupiedMap);
20607
+ }
20608
+ }
20609
+ };
20610
+
20611
+
20519
20612
  /** @public
20520
20613
  * @param {number} from
20521
20614
  * @param {number} amount This can be negative number
@@ -20532,18 +20625,10 @@ CellSpans.prototype.shiftColumn = function (from, amount) { // Use when a column
20532
20625
  cellSpan.indexX += amount;
20533
20626
  }
20534
20627
  }
20535
- if(!dirty) { return false; }
20628
+ if(!dirty || this._frozenMapping) { return false; }
20536
20629
 
20537
20630
  // Re-registers all cellspans. Some of the cellspans may be lost due to shifting
20538
- var cellSpans = this._spans;
20539
- this._spans = [];
20540
- this._occupiedMap = {};
20541
- for(i = cellSpans.length; --i >= 0;) {
20542
- cellSpan = cellSpans[i];
20543
- if(cellSpan.indexX >= 0) {
20544
- cellSpan.register(this._spans, this._occupiedMap);
20545
- }
20546
- }
20631
+ this._mapCellSpans();
20547
20632
  return true;
20548
20633
  };
20549
20634
  /** @public
@@ -20832,6 +20917,12 @@ CellSpans.prototype._spans;
20832
20917
  */
20833
20918
  CellSpans.prototype._occupiedMap;
20834
20919
 
20920
+ /**
20921
+ * @private
20922
+ * @type {boolean}
20923
+ */
20924
+ CellSpans.prototype._frozenMapping = false;
20925
+
20835
20926
  /* harmony default export */ var components_CellSpans = (CellSpans);
20836
20927
 
20837
20928
 
@@ -24585,6 +24676,7 @@ LayoutGrid.prototype.setFrozenLayout = function (bool) {
24585
24676
  if (this._frozenLayout !== bool) {
24586
24677
  this._frozenLayout = bool;
24587
24678
 
24679
+ this._cellSpans.freezeMapping(this._frozenLayout);
24588
24680
  if (!this._frozenLayout) {
24589
24681
  this._syncLayoutToColumns(0);
24590
24682
  this._syncLayoutToRows(0, this._rowCount);
@@ -29299,6 +29391,20 @@ DataView.prototype.isCollapsed = function() {
29299
29391
  DataView.prototype.enableContentAsHeader = function(bool) {
29300
29392
  this._shared.contentAsHeader = bool !== false;
29301
29393
  };
29394
+ /** set default collapse when new groups added
29395
+ * @public
29396
+ * @param {boolean=} collapse=false, if enable it, it will be set collapsing by default
29397
+ */
29398
+ DataView.prototype.setDefaultCollapse = function(collapse) {
29399
+ this._shared.defaultCollapse = !!collapse;
29400
+ };
29401
+ /** get default collapse when new groups added
29402
+ * @public
29403
+ * @return {boolean}
29404
+ */
29405
+ DataView.prototype.getDefaultCollapse = function() {
29406
+ return !!this._shared.defaultCollapse; // it can be null, convert to boolean
29407
+ };
29302
29408
  /** @private
29303
29409
  * @return {?Array.<string>}
29304
29410
  */
@@ -31217,6 +31323,10 @@ DataView.prototype._addGroup = function (value) {
31217
31323
  }
31218
31324
  }
31219
31325
  member = new DataView();
31326
+ var collapsed = this._shared.defaultCollapse;
31327
+ if(collapsed != null) {
31328
+ member._collapsed = collapsed;
31329
+ }
31220
31330
  member._groupId = groupId;
31221
31331
  if(typeof value == "string") { // TODO: Raw value should not always be a string
31222
31332
  if(value == "null") {
@@ -34529,7 +34639,7 @@ Core.prototype._rowHeightTimerId = 0;
34529
34639
  * @return {string}
34530
34640
  */
34531
34641
  Core.getVersion = function () {
34532
- return "5.1.30";
34642
+ return "5.1.32";
34533
34643
  };
34534
34644
  /** {@link ElementWrapper#dispose}
34535
34645
  * @override
@@ -36881,6 +36991,13 @@ Core.prototype.freezeLayout = function (opt_bool) {
36881
36991
  if (prevState !== opt_bool) {
36882
36992
  this._frozenLayout = opt_bool;
36883
36993
 
36994
+ var stp = this.getPlugin("SortableTitlePlugin");
36995
+ if(this._frozenLayout) {
36996
+ if(stp) {
36997
+ stp.freezeIndicator(true);
36998
+ }
36999
+ }
37000
+
36884
37001
  if (!this._frozenLayout) {
36885
37002
  // Width has not yet changed so we need to disable it first
36886
37003
  this._disableEvent("widthChanged");
@@ -36909,6 +37026,9 @@ Core.prototype.freezeLayout = function (opt_bool) {
36909
37026
  if(!viewChanged) { // Always update virtualizer
36910
37027
  this._rowVirtualizer.update(true); // Force section activation
36911
37028
  }
37029
+ if(stp) {
37030
+ stp.freezeIndicator(false);
37031
+ }
36912
37032
  }
36913
37033
  this._rowHeightSync = true;
36914
37034
  }
@@ -39479,6 +39599,7 @@ ReferenceCounter.prototype.getSession = function() {
39479
39599
  } else if(val < 0) {
39480
39600
  removedEntries.push(key);
39481
39601
  }
39602
+ // else {} // when val 0 do nothing, doesn't change anything
39482
39603
  }
39483
39604
  return {
39484
39605
  newEntries: newEntries.filter(Boolean),
@@ -39507,9 +39628,15 @@ ReferenceCounter.prototype.addReference = function(key, referer) {
39507
39628
 
39508
39629
  if(this._counter[key]) {
39509
39630
  ++this._counter[key];
39631
+ // The session will not change when a field already exists and a counter is attempted to be added
39510
39632
  } else {
39511
39633
  this._counter[key] = 1;
39512
- this._session[key] = 1;
39634
+ if(this._session[key] === -1) {
39635
+ this._session[key] = 0;
39636
+ } else {
39637
+ this._session[key] = 1;
39638
+ }
39639
+
39513
39640
  return true;
39514
39641
  }
39515
39642
  }
@@ -39559,7 +39686,11 @@ ReferenceCounter.prototype.removeReference = function(key, referer, count) {
39559
39686
  val -= count;
39560
39687
  if(!val || val < 0) {
39561
39688
  delete this._counter[key];
39562
- this._session[key] = -1;
39689
+ if(this._session[key] === 1) {
39690
+ this._session[key] = 0;
39691
+ } else {
39692
+ this._session[key] = -1;
39693
+ }
39563
39694
  return true;
39564
39695
  }
39565
39696
 
@@ -40252,6 +40383,10 @@ SortableTitlePlugin.prototype._userManagedLogic = false;
40252
40383
  * @type {boolean}
40253
40384
  */
40254
40385
  SortableTitlePlugin.prototype._disabled = false;
40386
+ /** @private
40387
+ * @type {boolean}
40388
+ */
40389
+ SortableTitlePlugin.prototype._frozenIndicator = false;
40255
40390
  /** Since DataView in real-time grid has only one ROW_DEF column, we need to re-map sorting field to sort correctly.
40256
40391
  * @private
40257
40392
  * @type {boolean}
@@ -40810,8 +40945,9 @@ SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
40810
40945
  * @param {Object=} opt_arg Event argument to be sent with preDataSorting event
40811
40946
  */
40812
40947
  SortableTitlePlugin.prototype.clearSortState = function (opt_arg) {
40813
- this._popSortState(0, opt_arg);
40814
- this.updateSortSymbols();
40948
+ if(this._popSortState(0, opt_arg)) {
40949
+ this.updateSortSymbols();
40950
+ }
40815
40951
  };
40816
40952
  /** @description Perform sorting with the same parameter.
40817
40953
  * @public
@@ -41016,6 +41152,12 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
41016
41152
 
41017
41153
  };
41018
41154
  /** @public
41155
+ * @param {boolean=} bool=true, if set to false it will be unfreeze indicator
41156
+ */
41157
+ SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
41158
+ this._frozenIndicator = bool !== false;
41159
+ };
41160
+ /** @public
41019
41161
  * @param {boolean=} disabled
41020
41162
  */
41021
41163
  SortableTitlePlugin.prototype.disableSortSymbols = function (disabled) {
@@ -41628,7 +41770,7 @@ SortableTitlePlugin.prototype._clearSortSymbols = function (state) {
41628
41770
  SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
41629
41771
  var t = this;
41630
41772
  var host = t._hosts[hostIndex];
41631
- if (!host) { return; }
41773
+ if (!host || this._frozenIndicator) { return; }
41632
41774
 
41633
41775
  var section = host.getSection("title");
41634
41776
  if (section == null) { return; }
@@ -41916,6 +42058,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
41916
42058
  * @property {boolean=} formulaEngine=false If enabled, field with leading equal sign will be treated as a formula and rows will be filled with the calculated values.
41917
42059
  * @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
41918
42060
  * @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
42061
+ * @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
41919
42062
  */
41920
42063
 
41921
42064
  /** @typedef {number|string|RowDefinition} Grid~RowReference
@@ -42378,6 +42521,10 @@ Grid.prototype._pollingEnabled = true;
42378
42521
  * @private
42379
42522
  */
42380
42523
  Grid.prototype._fieldCaching = false;
42524
+ /** @type {string}
42525
+ * @private
42526
+ */
42527
+ Grid.prototype._childDataField = "";
42381
42528
 
42382
42529
 
42383
42530
  /** @public
@@ -42792,6 +42939,9 @@ Grid.prototype.initialize = function(gridOption) {
42792
42939
  }
42793
42940
 
42794
42941
  // Row operations
42942
+ if(gridOption["childDataField"] != null) {
42943
+ this._childDataField = RowDefinition._childDataField = gridOption["childDataField"];
42944
+ }
42795
42945
  var rows = gridOption["rows"];
42796
42946
  if(!rows) {
42797
42947
  rows = gridOption["rics"] || null; // Make "rics" an alias to "rows"
@@ -42947,6 +43097,10 @@ Grid.prototype.getConfigObject = function (gridOptions) {
42947
43097
  obj["fieldCaching"] = this._fieldCaching;
42948
43098
  }
42949
43099
 
43100
+ if(this._childDataField) {
43101
+ obj["childDataField"] = this._childDataField;
43102
+ }
43103
+
42950
43104
  // get all rows config
42951
43105
  var rowDefs = this.getAllRowDefinitions();
42952
43106
  var rows = obj["rows"] = [];
@@ -43084,9 +43238,8 @@ Grid.prototype._onFieldAdded = function(e) {
43084
43238
 
43085
43239
  // JET
43086
43240
  if (this._subs) {
43087
- var colDefs = this.getColumnDefinitions();
43088
- var fields = colDefs.reduce(ColumnDefinition.getRealTimeFields, []);
43089
- this._subs["addFields"](fields);
43241
+ var realtimeFields = addedFields.filter(ColumnDefinition.isRealTimeField);
43242
+ this._subs["addFields"](realtimeFields);
43090
43243
  }
43091
43244
 
43092
43245
  this._dispatch(e.type, e);
@@ -43097,6 +43250,7 @@ Grid.prototype._onFieldAdded = function(e) {
43097
43250
  Grid.prototype._onFieldRemoved = function(e) {
43098
43251
  var removedFields = e.removedFields;
43099
43252
 
43253
+ // TODO: ADC fields have an interval load. Currently, we only keep the field but do not delete it.
43100
43254
  // JET
43101
43255
  if(this._subs) {
43102
43256
  this._subs["removeFields"](removedFields);
@@ -43350,15 +43504,7 @@ Grid.prototype._onFieldLoadedError = function (err) {
43350
43504
  * @param {string} referrer
43351
43505
  */
43352
43506
  Grid.prototype._onFieldLoaded = function (field, referrer) {
43353
- // async process, the field can be remove before column added
43354
- var colIndex = this.getColumnIndex(field);
43355
- if(colIndex > -1) {
43356
- var colDef = this._getColumnDefinition(field);
43357
- if(colDef.isTimeSeriesField()) {
43358
- this._insertTimeSeriesChildren(colDef);
43359
- }
43360
- this._connector.addFields(field, referrer);
43361
- }
43507
+ this._connector.addFields(field, referrer);
43362
43508
  };
43363
43509
 
43364
43510
  /**
@@ -43677,6 +43823,62 @@ Grid.prototype.moveColumnById = function (srcCol, destCol) {
43677
43823
  return this.moveColumn(srcIndex, destIndex);
43678
43824
  };
43679
43825
 
43826
+ /** @public
43827
+ * @param {number|string|Array.<number|string>} colRefs List of column index or column id to be moved
43828
+ * @param {number|string} destCol Destination position where the moved columns will be placed BEFORE the specified position. This can be column id or index
43829
+ * @return {boolean} Return true if there is any change, and false otherwise
43830
+ */
43831
+ Grid.prototype.reorderColumns = function (colRefs, destCol) {
43832
+ var destId = (typeof destCol === "number") ? this.getColumnId(destCol) : destCol;
43833
+
43834
+ if(Array.isArray(colRefs)) {
43835
+ var srcLen = colRefs.length;
43836
+ if(srcLen > 1) {
43837
+ var colIds = this.getColumnIds();
43838
+ var srcIds = [];
43839
+ var invalidDest = false;
43840
+ var i;
43841
+ for(i = 0; i < srcLen; ++i) {
43842
+ var colRef = colRefs[i];
43843
+ var srcId = (typeof colRef === "number") ? colIds[colRef] : colRef;
43844
+ if(srcId) {
43845
+ srcIds.push(srcId);
43846
+ if(destId === srcId) {
43847
+ invalidDest = true; // Destination must not exist in source columns
43848
+ }
43849
+ }
43850
+ }
43851
+ srcLen = srcIds.length;
43852
+ if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
43853
+ var colCount = colIds.length;
43854
+ var destIdx = this.getColumnIndex(destId);
43855
+ if(destIdx >= 0) {
43856
+ while(++destIdx < colCount) {
43857
+ destId = colIds[destIdx];
43858
+ if(srcIds.indexOf(destId) < 0) {
43859
+ break;
43860
+ }
43861
+ }
43862
+ }
43863
+ if(destIdx < 0 || destIdx >= colCount) {
43864
+ destId = "";
43865
+ }
43866
+ }
43867
+
43868
+ var dirty = 0;
43869
+ for(i = 0; i < srcLen; ++i) {
43870
+ dirty |= this.moveColumnById(srcIds[i], destId);
43871
+ }
43872
+ // TODO: Handle the case where all columns stay in the same place
43873
+ return dirty ? true : false;
43874
+ } else {
43875
+ return this.moveColumnById(colRefs[0], destId);
43876
+ }
43877
+ }
43878
+
43879
+ // colRefs will be a number or string
43880
+ return this.moveColumnById(colRefs, destId);
43881
+ };
43680
43882
 
43681
43883
  /** The hidden column still occupies the same index.
43682
43884
  * @public
@@ -44867,7 +45069,7 @@ Grid.prototype.unpinColumn = function(colRef, dest) {
44867
45069
  var len = ary.length;
44868
45070
 
44869
45071
  var dirty = 0;
44870
- for(var i = 0; i < len; ++i) {
45072
+ for(var i = len; --i >= 0;) { // WARNING: unpinning is done in reversed order
44871
45073
  dirty |= this._unpinColumn(ary[i], dest);
44872
45074
  }
44873
45075
  return dirty ? true : false;