@refinitiv-ui/efx-grid 6.0.86 → 6.0.88

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.
Files changed (49) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.js +55 -0
  2. package/lib/column-format-dialog/lib/column-format-dialog.js +5 -8
  3. package/lib/column-format-dialog/lib/preview-table.d.ts +1 -1
  4. package/lib/column-format-dialog/lib/preview-table.js +15 -15
  5. package/lib/column-selection-dialog/themes/base.less +0 -1
  6. package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +1 -1
  7. package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
  8. package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +1 -1
  9. package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +1 -1
  10. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  11. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  12. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  13. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  14. package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +1 -1
  15. package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
  16. package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +1 -1
  17. package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
  18. package/lib/core/dist/core.js +8 -2
  19. package/lib/core/dist/core.min.js +1 -1
  20. package/lib/core/es6/data/DataView.js +1 -1
  21. package/lib/core/es6/grid/Core.d.ts +2 -0
  22. package/lib/core/es6/grid/Core.js +7 -1
  23. package/lib/grid/index.js +1 -1
  24. package/lib/rt-grid/dist/rt-grid.js +789 -712
  25. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  26. package/lib/rt-grid/es6/ColumnDefinition.js +70 -70
  27. package/lib/rt-grid/es6/DataConnector.js +26 -26
  28. package/lib/rt-grid/es6/FieldDefinition.js +27 -27
  29. package/lib/rt-grid/es6/Grid.js +385 -376
  30. package/lib/rt-grid/es6/PredefinedFormula.js +1 -1
  31. package/lib/rt-grid/es6/ReferenceCounter.js +15 -15
  32. package/lib/rt-grid/es6/RowDefSorter.js +26 -26
  33. package/lib/rt-grid/es6/RowDefinition.d.ts +5 -2
  34. package/lib/rt-grid/es6/RowDefinition.js +106 -77
  35. package/lib/rt-grid/es6/SnapshotFiller.js +77 -77
  36. package/lib/rt-grid/es6/StyleLoader.js +1 -1
  37. package/lib/tr-grid-percent-bar/es6/PercentBar.d.ts +18 -18
  38. package/lib/tr-grid-percent-bar/es6/PercentBar.js +4 -0
  39. package/lib/tr-grid-range-bar/es6/RangeBar.js +4 -1
  40. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
  41. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +31 -19
  42. package/lib/tr-grid-util/es6/DragUI.js +2 -1
  43. package/lib/types/es6/Checkbox.d.ts +2 -0
  44. package/lib/types/es6/Core/grid/Core.d.ts +2 -0
  45. package/lib/types/es6/PercentBar.d.ts +18 -18
  46. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +5 -2
  47. package/lib/types/es6/RowFiltering.d.ts +2 -0
  48. package/lib/versions.json +7 -7
  49. package/package.json +1 -1
@@ -179,13 +179,13 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
179
179
  * @private
180
180
  * @const
181
181
  */
182
- var SUB_ID = "SUB_ID";
182
+ const SUB_ID = "SUB_ID";
183
183
 
184
184
  /** @private
185
185
  * @param {RowDefinition} rowDef
186
186
  * @return {Object}
187
187
  */
188
- var toRowData = function(rowDef) {
188
+ let toRowData = function(rowDef) {
189
189
  return rowDef ? rowDef.getRowData() : null;
190
190
  };
191
191
 
@@ -193,7 +193,7 @@ var toRowData = function(rowDef) {
193
193
  * @const
194
194
  * @type {Object.<string, number>}
195
195
  */
196
- var _unclonableFields = {
196
+ let _unclonableFields = {
197
197
  "ROW_DEF": 1,
198
198
  "SUB_ID": 1
199
199
  };
@@ -201,10 +201,10 @@ var _unclonableFields = {
201
201
  * @param {RowDefinition} fromRowDef
202
202
  * @param {RowDefinition} toRowDef
203
203
  */
204
- var cloneRowData = function(fromRowDef, toRowDef) {
205
- var from = toRowData(fromRowDef);
206
- var to = toRowData(toRowDef);
207
- for(var key in from) {
204
+ let cloneRowData = function(fromRowDef, toRowDef) {
205
+ let from = toRowData(fromRowDef);
206
+ let to = toRowData(toRowDef);
207
+ for(let key in from) {
208
208
  if(!_unclonableFields[key]) {
209
209
  to[key] = from[key];
210
210
  }
@@ -215,7 +215,7 @@ var cloneRowData = function(fromRowDef, toRowDef) {
215
215
  * @param {RowDefinition} rowDef
216
216
  * @return {boolean}
217
217
  */
218
- var excludeAutoGenerated = function (rowDef) {
218
+ let excludeAutoGenerated = function (rowDef) {
219
219
  return !rowDef.isAutoGenerated();
220
220
  };
221
221
 
@@ -223,7 +223,7 @@ var excludeAutoGenerated = function (rowDef) {
223
223
  * @param {Object} colConfig column config
224
224
  * @return {boolean}
225
225
  */
226
- var _byNonAutoGeneratedColumn = function (colConfig) {
226
+ let _byNonAutoGeneratedColumn = function (colConfig) {
227
227
  return !colConfig.autoGenerated;
228
228
  };
229
229
  /** @private
@@ -233,7 +233,7 @@ var _byNonAutoGeneratedColumn = function (colConfig) {
233
233
  * @param {string} fieldName
234
234
  * @return {number} The outcome of the value comparison
235
235
  */
236
- var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit name
236
+ let compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit name
237
237
  return (rowDefA.getData(fieldName) - rowDefB.getData(fieldName)) * sortOrder; // for numeric comparison
238
238
  };
239
239
 
@@ -244,14 +244,14 @@ var compareNumber = function(rowDefA, rowDefB, sortOrder, fieldName) { // edit n
244
244
  * @param {string} sortOrder
245
245
  * @return {number} The outcome of the value comparison
246
246
  */
247
- var _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
248
- var parentA = rowDefA.getParent();
247
+ let _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
248
+ let parentA = rowDefA.getParent();
249
249
 
250
250
  if (!parentA) {
251
251
  return 0;
252
252
  }
253
253
 
254
- var parentB = rowDefB.getParent();
254
+ let parentB = rowDefB.getParent();
255
255
 
256
256
  if (!parentB) {
257
257
  return 0;
@@ -261,13 +261,13 @@ var _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
261
261
  return 0;
262
262
  }
263
263
 
264
- var a = rowDefA.getData('CHILD_ORDER');
264
+ let a = rowDefA.getData('CHILD_ORDER');
265
265
 
266
266
  if (a == null) {
267
267
  return 0;
268
268
  }
269
269
 
270
- var b = rowDefB.getData('CHILD_ORDER');
270
+ let b = rowDefB.getData('CHILD_ORDER');
271
271
 
272
272
  if (b == null) {
273
273
  return 0;
@@ -280,7 +280,7 @@ var _sortChildrenOfChain = function (rowDefA, rowDefB, sortOrder) {
280
280
  * @param {ColumnDefinition} colDef
281
281
  * @return {string}
282
282
  */
283
- var _getName = function(colDef) {
283
+ let _getName = function(colDef) {
284
284
  if(colDef) {
285
285
  return colDef.getName();
286
286
  }
@@ -291,7 +291,7 @@ var _getName = function(colDef) {
291
291
  * @param {string} str
292
292
  * @return {boolean}
293
293
  */
294
- var _hasFieldOrId = function(colDef, str) {
294
+ let _hasFieldOrId = function(colDef, str) {
295
295
  return (colDef.getField() === str) || (colDef.getId() === str);
296
296
  };
297
297
 
@@ -301,7 +301,7 @@ var _hasFieldOrId = function(colDef, str) {
301
301
  * @param {Object} obj2
302
302
  * @returns {boolean} If the id property of two objects is equal, the return will be true, otherwise it will be false.
303
303
  */
304
- var _hasMatchingId = function(obj1, obj2) {
304
+ let _hasMatchingId = function(obj1, obj2) {
305
305
  if(!obj1 || !obj2 || !obj1.id || !obj2.id) { // Handle nullable, if the object or id have null, it's means difference value
306
306
  return false;
307
307
  }
@@ -313,8 +313,8 @@ var _hasMatchingId = function(obj1, obj2) {
313
313
  * @param {(Element|null)=} placeholder
314
314
  * @param {Grid~GridOptions=} config
315
315
  */
316
- var Grid = function(placeholder, config) {
317
- var t = this; // This is to primarily reduce file size
316
+ let Grid = function(placeholder, config) {
317
+ let t = this; // This is to primarily reduce file size
318
318
 
319
319
  t._onDataChanged = t._onDataChanged.bind(t);
320
320
  t._onQuote2PostUpdate = t._onQuote2PostUpdate.bind(t);
@@ -372,7 +372,7 @@ var Grid = function(placeholder, config) {
372
372
  t._dt = t._dv.getDataTable();
373
373
  t._mainGrid = config["grid"];
374
374
 
375
- var core = t._mainGrid.getCoreGrid();
375
+ let core = t._mainGrid.getCoreGrid();
376
376
  t._stp = core.getPlugin("SortableTitlePlugin");
377
377
  }
378
378
  if(config["SortableTitle"]) { // Exception for built-in plugin
@@ -667,7 +667,7 @@ Grid.prototype.initSubscription = function() {
667
667
  return;
668
668
  }
669
669
 
670
- var jet, q, s;
670
+ let jet, q, s;
671
671
  jet = window["JET"]; // Assume that JET is already exist.
672
672
  if (this._RTK) {
673
673
  q = this._RTK.Quotes;
@@ -691,10 +691,10 @@ Grid.prototype.initSubscription = function() {
691
691
 
692
692
  // TODO: Subscriptions should be registered per row.
693
693
  // However, chain subscription cannot be integrated with DataConnector in this current implementation.
694
- var rowDefs = this._getAllRowDefinitions();
695
- var len = rowDefs.length;
696
- for(var i = 0; i < len; ++i) {
697
- var rowDef = rowDefs[i];
694
+ let rowDefs = this._getAllRowDefinitions();
695
+ let len = rowDefs.length;
696
+ for(let i = 0; i < len; ++i) {
697
+ let rowDef = rowDefs[i];
698
698
  if(rowDef) {
699
699
  rowDef.subscribeForUpdates();
700
700
  }
@@ -713,7 +713,7 @@ Grid.prototype.updateLayout = function() {
713
713
  */
714
714
  Grid.prototype._updateRowData = function(rowIndex) {
715
715
  if(rowIndex >= 0) {
716
- var rowId = this._dv.getRowId(rowIndex);
716
+ let rowId = this._dv.getRowId(rowIndex);
717
717
  if(rowId) {
718
718
  this._dt.setRowData(rowId, {});
719
719
  }
@@ -730,7 +730,7 @@ Grid.prototype.updateRowData = Grid.prototype._updateRowData;
730
730
  /** @private
731
731
  */
732
732
  Grid.prototype._addGridSections = function () {
733
- var title = this._grid.addSection("title");
733
+ let title = this._grid.addSection("title");
734
734
  if(this._topSection == false){
735
735
  title.setRowCount(0);
736
736
  } else {
@@ -738,10 +738,10 @@ Grid.prototype._addGridSections = function () {
738
738
  }
739
739
  this._grid.addSection("content");
740
740
 
741
- var titleSettings = this._grid.getSectionSettings("title");
741
+ let titleSettings = this._grid.getSectionSettings("title");
742
742
  titleSettings.disableDataBinding();
743
743
 
744
- var contentSettings = this._grid.getSectionSettings("content");
744
+ let contentSettings = this._grid.getSectionSettings("content");
745
745
  contentSettings.setAutoSyncRowCount(true);
746
746
  contentSettings.setParent(titleSettings);
747
747
  };
@@ -750,13 +750,13 @@ Grid.prototype._addGridSections = function () {
750
750
  * @return {*} Return Section instance
751
751
  */
752
752
  Grid.prototype.addHeaderSection = function (sectionName) {
753
- var titleSects = this._grid.getAllSections("title");
753
+ let titleSects = this._grid.getAllSections("title");
754
754
 
755
- var headerSect = this._grid.addSectionAt(titleSects.length, "title", sectionName);
755
+ let headerSect = this._grid.addSectionAt(titleSects.length, "title", sectionName);
756
756
  if(headerSect) {
757
757
  headerSect.setRowCount(1);
758
758
 
759
- var headerSettings = this._grid.getSectionSettings(headerSect);
759
+ let headerSettings = this._grid.getSectionSettings(headerSect);
760
760
  headerSettings.disableDataBinding();
761
761
  }
762
762
 
@@ -767,11 +767,11 @@ Grid.prototype.addHeaderSection = function (sectionName) {
767
767
  * @return {*} Return Section instance
768
768
  */
769
769
  Grid.prototype.addFooterSection = function (sectionName) {
770
- var footerSect = this._grid.addSection("footer", sectionName);
770
+ let footerSect = this._grid.addSection("footer", sectionName);
771
771
  if(footerSect) {
772
772
  footerSect.setRowCount(1);
773
773
 
774
- var footerSettings = this._grid.getSectionSettings(footerSect);
774
+ let footerSettings = this._grid.getSectionSettings(footerSect);
775
775
  footerSettings.disableDataBinding();
776
776
  }
777
777
 
@@ -790,7 +790,7 @@ Grid.prototype.setParent = function (elem) {
790
790
  */
791
791
  Grid.prototype.insertBefore = function (elem) {
792
792
  if(elem) {
793
- var pn = elem.parentNode;
793
+ let pn = elem.parentNode;
794
794
  if(pn) {
795
795
  pn.insertBefore(this._topNode, elem);
796
796
  this.updateLayout();
@@ -826,15 +826,15 @@ Grid.prototype.getCoreGrid = function () {
826
826
  Grid.prototype.initialize = function(gridOption) {
827
827
  if (!gridOption) { return; }
828
828
  // TODO: clear all data before re-initialization
829
- var t = this; // For minimizing file size
829
+ let t = this; // For minimizing file size
830
830
  t._initializing = true;
831
- var grid = t._grid; // core grid
831
+ let grid = t._grid; // core grid
832
832
  grid.resetInternalState();
833
833
  gridOption = grid.normalizeConfig(gridOption);
834
834
 
835
- var exts = gridOption["plugins"] || gridOption["extensions"];
835
+ let exts = gridOption["plugins"] || gridOption["extensions"];
836
836
 
837
- var cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
837
+ let cols = /** @type{Array} */(gridOption["fields"] || gridOption["columns"]);
838
838
  if (gridOption["defaultColumnOptions"]) {
839
839
  t._defaultColumnOptions = gridOption["defaultColumnOptions"];
840
840
  t._defaultColumnSetup(t._defaultColumnOptions, cols);
@@ -884,23 +884,23 @@ Grid.prototype.initialize = function(gridOption) {
884
884
  t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
885
885
  }
886
886
 
887
- var borders = gridOption["borders"];
887
+ let borders = gridOption["borders"];
888
888
  if (borders != null) {
889
889
  grid.toggleBorders(borders);
890
890
  }
891
- var gridlines = gridOption["gridlines"];
891
+ let gridlines = gridOption["gridlines"];
892
892
  if (gridlines != null) {
893
893
  grid.toggleGridlines(gridlines);
894
894
  }
895
- var vLines = gridOption["verticalLines"];
895
+ let vLines = gridOption["verticalLines"];
896
896
  if (vLines != null) {
897
897
  grid.toggleVerticalLines(vLines);
898
898
  }
899
- var cvLines = gridOption["contentVerticalLines"];
899
+ let cvLines = gridOption["contentVerticalLines"];
900
900
  if (cvLines != null) {
901
901
  grid.toggleContentVerticalLines(cvLines);
902
902
  }
903
- var hLines = gridOption["horizontalLines"];
903
+ let hLines = gridOption["horizontalLines"];
904
904
  if (hLines != null) {
905
905
  grid.toggleHorizontalLines(hLines);
906
906
  }
@@ -909,28 +909,28 @@ Grid.prototype.initialize = function(gridOption) {
909
909
  t._dv.setPageSize(+gridOption["pageSize"]);
910
910
  }
911
911
 
912
- var rowHeight = +gridOption["rowHeight"];
912
+ let rowHeight = +gridOption["rowHeight"];
913
913
  if(rowHeight) { // Non empty or zero
914
914
  grid.setDefaultRowHeight(rowHeight);
915
915
  }
916
- var hRowHeight = +gridOption["headerRowHeight"];
916
+ let hRowHeight = +gridOption["headerRowHeight"];
917
917
  if(hRowHeight) { // Non empty or zero
918
918
  grid.getSection("title").setDefaultRowHeight(hRowHeight);
919
919
  }
920
920
 
921
- var val = gridOption["autoLayoutUpdate"];
921
+ let val = gridOption["autoLayoutUpdate"];
922
922
  if(!t._autoLayoutTimer && val) {
923
923
  if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
924
924
  t._autoLayoutTimer = setInterval(t._onAutoLayoutUpdate.bind(t), 2000);
925
925
  }
926
926
  }
927
927
 
928
- var bool = gridOption["rowHighlighting"];
928
+ let bool = gridOption["rowHighlighting"];
929
929
  if(bool != null) {
930
930
  grid.enableRowHighlighting(!!bool);
931
931
  }
932
932
 
933
- var rowExpansionBinding = gridOption["rowExpansionBinding"];
933
+ let rowExpansionBinding = gridOption["rowExpansionBinding"];
934
934
  if(typeof rowExpansionBinding === "function") {
935
935
  grid.listen("rowExpansionBinding", t._onRowExpansionBinding); // TODO: Support multi-table feature
936
936
  t.listen("rowExpansionBinding", rowExpansionBinding);
@@ -957,7 +957,7 @@ Grid.prototype.initialize = function(gridOption) {
957
957
  if(gridOption["scrollbarParent"] != null) {
958
958
  t._setScrollbarParent(gridOption["scrollbarParent"]);
959
959
  }
960
- var pollingInterval = gridOption["adcPollingInterval"];
960
+ let pollingInterval = gridOption["adcPollingInterval"];
961
961
  if(pollingInterval != null) {
962
962
  t._pollingInterval = pollingInterval ? +pollingInterval : 0;
963
963
  }
@@ -965,7 +965,7 @@ Grid.prototype.initialize = function(gridOption) {
965
965
  // Column operations
966
966
  t.setColumns(cols);
967
967
 
968
- var rowVir = true;
968
+ let rowVir = true;
969
969
  if (gridOption["rowVirtualRendering"] != null) {
970
970
  rowVir = gridOption["rowVirtualRendering"];
971
971
  }
@@ -974,7 +974,7 @@ Grid.prototype.initialize = function(gridOption) {
974
974
  }
975
975
  grid.enableRowVirtualization(!!rowVir);
976
976
 
977
- var colVir = false;
977
+ let colVir = false;
978
978
  if (gridOption["columnVirtualRendering"] != null) {
979
979
  colVir = gridOption["columnVirtualRendering"];
980
980
  }
@@ -983,7 +983,7 @@ Grid.prototype.initialize = function(gridOption) {
983
983
  }
984
984
  grid.enableColumnVirtualization(!!colVir);
985
985
 
986
- var scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
986
+ let scrollbar = gridOption["scrollbar"] != null ? gridOption["scrollbar"] : true;
987
987
  if (scrollbar) {
988
988
  t._topNode.style.overflow = "hidden"; // TODO: Move this to CSS Class
989
989
  } else {
@@ -991,16 +991,16 @@ Grid.prototype.initialize = function(gridOption) {
991
991
  t._topNode.style.overflow = "";
992
992
  }
993
993
 
994
- var topFreezingCount = gridOption["topFreezingCount"];
994
+ let topFreezingCount = gridOption["topFreezingCount"];
995
995
  if (typeof topFreezingCount === "number") {
996
996
  topFreezingCount = (topFreezingCount > 0) ? topFreezingCount : 0;
997
- var sectionIndex = topFreezingCount - 1;
997
+ let sectionIndex = topFreezingCount - 1;
998
998
  grid.freezeSection(sectionIndex);
999
999
  } else if (topFreezingCount === false) {
1000
1000
  grid.freezeSection(null);
1001
1001
  }
1002
1002
 
1003
- var bottomFreezingCount = gridOption["bottomFreezingCount"];
1003
+ let bottomFreezingCount = gridOption["bottomFreezingCount"];
1004
1004
  if (typeof bottomFreezingCount === "number") {
1005
1005
  bottomFreezingCount = (bottomFreezingCount > 0) ? bottomFreezingCount : 0;
1006
1006
  grid.freezeFooter(bottomFreezingCount);
@@ -1011,11 +1011,11 @@ Grid.prototype.initialize = function(gridOption) {
1011
1011
  // Plugins
1012
1012
  gridOption[ROW_DEF] = true; // Enable ROW_DEF mode
1013
1013
  if (Array.isArray(exts)) {
1014
- for (var i = 0; i < exts.length; ++i) {
1015
- var ext = exts[i];
1016
- var extInstance = null;
1014
+ for (let i = 0; i < exts.length; ++i) {
1015
+ let ext = exts[i];
1016
+ let extInstance = null;
1017
1017
  if (ext) {
1018
- var extName = ext["name"];
1018
+ let extName = ext["name"];
1019
1019
  if(extName) {
1020
1020
  extInstance = grid.loadPlugin(extName, ext); // pass plugin object as an argument for initialization
1021
1021
  } else {
@@ -1023,7 +1023,7 @@ Grid.prototype.initialize = function(gridOption) {
1023
1023
  }
1024
1024
  }
1025
1025
  if (extInstance && extInstance["setGridWrapper"]) {
1026
- var hasApi = (typeof extInstance["getGridApi"] === "function") ? extInstance["getGridApi"]() : false;
1026
+ let hasApi = (typeof extInstance["getGridApi"] === "function") ? extInstance["getGridApi"]() : false;
1027
1027
  if(!hasApi) {
1028
1028
  extInstance["setGridWrapper"]("realTimeGrid", t);
1029
1029
  }
@@ -1032,7 +1032,7 @@ Grid.prototype.initialize = function(gridOption) {
1032
1032
  t._initializing = false;
1033
1033
  }
1034
1034
 
1035
- var lang = gridOption["lang"];
1035
+ let lang = gridOption["lang"];
1036
1036
  if(lang != null) {
1037
1037
  t._lang = lang;
1038
1038
  t._dateTimeUtil.setLocale(lang);
@@ -1042,18 +1042,18 @@ Grid.prototype.initialize = function(gridOption) {
1042
1042
  if(gridOption["childDataField"] != null) {
1043
1043
  this._childDataField = RowDefinition._childDataField = gridOption["childDataField"];
1044
1044
  }
1045
- var rows = gridOption["rows"];
1045
+ let rows = gridOption["rows"];
1046
1046
  if(!rows) {
1047
1047
  rows = gridOption["rics"] || null; // Make "rics" an alias to "rows"
1048
1048
  }
1049
- var bodies = /** @type{Array} */(gridOption["bodies"]);
1049
+ let bodies = /** @type{Array} */(gridOption["bodies"]);
1050
1050
  if(!bodies) {
1051
1051
  bodies = [];
1052
1052
  if(gridOption["body"]) {
1053
1053
  bodies.push(gridOption["body"]);
1054
1054
  }
1055
1055
  if(rows) {
1056
- for(var m = 0; m < rows.length; m++) {
1056
+ for(let m = 0; m < rows.length; m++) {
1057
1057
  if(typeof rows[m] === "string") {
1058
1058
  rows[m] = { "ric": rows[m] };
1059
1059
  }
@@ -1063,13 +1063,13 @@ Grid.prototype.initialize = function(gridOption) {
1063
1063
  }
1064
1064
 
1065
1065
  // Merge rows with static data rows
1066
- var staticRows = gridOption["staticDataRows"] || gridOption["dataModel"];
1066
+ let staticRows = gridOption["staticDataRows"] || gridOption["dataModel"];
1067
1067
  if(rows && staticRows) {
1068
- var ary = staticRows["data"] ? staticRows["data"] : staticRows;
1069
- var fields = staticRows["fields"] || t.getColumnFields();
1070
- var values, data;
1071
- var len = rows.length;
1072
- for(var n = 0; n < len; n++) {
1068
+ let ary = staticRows["data"] ? staticRows["data"] : staticRows;
1069
+ let fields = staticRows["fields"] || t.getColumnFields();
1070
+ let values, data;
1071
+ let len = rows.length;
1072
+ for(let n = 0; n < len; n++) {
1073
1073
  if(rows[n]["values"]) { // merge row's values, values can be object or array
1074
1074
  values = arrayToObject(rows[n]["values"], fields);
1075
1075
  data = arrayToObject(ary[n], fields);
@@ -1086,7 +1086,7 @@ Grid.prototype.initialize = function(gridOption) {
1086
1086
  }
1087
1087
  }
1088
1088
 
1089
- for(var j = 0; j < bodies.length; ++j) {
1089
+ for(let j = 0; j < bodies.length; ++j) {
1090
1090
  t.insertRows(bodies[j]["rows"]);
1091
1091
  // break; // TODO: The first version supports only 1 grid
1092
1092
  }
@@ -1097,7 +1097,7 @@ Grid.prototype.initialize = function(gridOption) {
1097
1097
  grid.setBottomPaddingSection(gridOption.contentBottomPadding);
1098
1098
  }
1099
1099
 
1100
- var contentRightPadding = gridOption.contentRightPadding;
1100
+ let contentRightPadding = gridOption.contentRightPadding;
1101
1101
  if(contentRightPadding) {
1102
1102
  if (typeof contentRightPadding !== "number") {
1103
1103
  contentRightPadding = 6;
@@ -1108,13 +1108,13 @@ Grid.prototype.initialize = function(gridOption) {
1108
1108
 
1109
1109
  // Let everything init first
1110
1110
  // then set conflationRate to grid for better perfomance on rapidly updating
1111
- var dataConflationRate = gridOption['dataConflationRate'];
1111
+ let dataConflationRate = gridOption['dataConflationRate'];
1112
1112
  if (dataConflationRate != null) {
1113
1113
  grid.setDataConflationRate(dataConflationRate);
1114
1114
  }
1115
1115
 
1116
1116
  // Tell all plugins that the initialization phase has ended
1117
- var extObjects = grid.getPluginList().map(grid.getPlugin.bind(grid));
1117
+ let extObjects = grid.getPluginList().map(grid.getPlugin.bind(grid));
1118
1118
  t._processExtension(extObjects, "afterInit");
1119
1119
  };
1120
1120
 
@@ -1123,14 +1123,14 @@ Grid.prototype.initialize = function(gridOption) {
1123
1123
  * @return {!Object}
1124
1124
  */
1125
1125
  Grid.prototype.getConfigObject = function (gridOptions) {
1126
- var obj = gridOptions || {};
1126
+ let obj = gridOptions || {};
1127
1127
 
1128
- var columns = obj.columns;
1128
+ let columns = obj.columns;
1129
1129
  if(!columns) {
1130
1130
  columns = obj.columns = [];
1131
1131
  }
1132
1132
 
1133
- var grid = this._grid;
1133
+ let grid = this._grid;
1134
1134
  if(grid.getConfigObject) {
1135
1135
  grid.getConfigObject(obj);
1136
1136
  }
@@ -1157,17 +1157,17 @@ Grid.prototype.getConfigObject = function (gridOptions) {
1157
1157
  }
1158
1158
 
1159
1159
 
1160
- var i, len, prevTimeSeriesField;
1160
+ let i, len, prevTimeSeriesField;
1161
1161
  len = this.getColumnCount();
1162
1162
  for (i = 0; i < len; ++i) {
1163
- var column = columns[i];
1163
+ let column = columns[i];
1164
1164
  if(!column) {
1165
1165
  column = columns[i] = {};
1166
1166
  }
1167
- var colDef = this.getColumnDefinition(i);
1167
+ let colDef = this.getColumnDefinition(i);
1168
1168
  // TODO: Update width and scalability changed by the extensions
1169
1169
  colDef.getConfigObject(column);
1170
- var parentField = FieldDefinition.getFieldProperty(colDef.getField(), "timeSeriesParent");
1170
+ let parentField = FieldDefinition.getFieldProperty(colDef.getField(), "timeSeriesParent");
1171
1171
  if(parentField && !prevTimeSeriesField) { // Assume first column of time series child to convert to time series parent
1172
1172
  prevTimeSeriesField = parentField;
1173
1173
  column.field = parentField;
@@ -1185,7 +1185,7 @@ Grid.prototype.getConfigObject = function (gridOptions) {
1185
1185
  obj["scrollbar"] = false;
1186
1186
  }
1187
1187
 
1188
- var val = this._dv.getPageSize();
1188
+ let val = this._dv.getPageSize();
1189
1189
  if(val > 0) {
1190
1190
  obj["pageSize"] = val;
1191
1191
  }
@@ -1238,9 +1238,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
1238
1238
  }
1239
1239
 
1240
1240
  // get all rows config
1241
- var rowDefs = this.getAllRowDefinitions();
1242
- var rows = obj["rows"] = [];
1243
- var rowDef, rowConfig;
1241
+ let rowDefs = this.getAllRowDefinitions();
1242
+ let rows = obj["rows"] = [];
1243
+ let rowDef, rowConfig;
1244
1244
  len = rowDefs.length;
1245
1245
  for (i = 0; i < len; i++) {
1246
1246
  rowDef = rowDefs[i];
@@ -1249,9 +1249,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
1249
1249
  }
1250
1250
 
1251
1251
  // get row config from extensions
1252
- var extensions = grid.getPlugins();
1253
- var pluginInstance, row;
1254
- for(var key in extensions) {
1252
+ let extensions = grid.getPlugins();
1253
+ let pluginInstance, row;
1254
+ for(let key in extensions) {
1255
1255
  pluginInstance = extensions[key];
1256
1256
  if(typeof pluginInstance["getRowConfigObject"] === "function") {
1257
1257
  len = rows.length;
@@ -1303,11 +1303,11 @@ Grid.prototype.setLocale = function(lang) {
1303
1303
  * @param {Array.<Object>} userColumns
1304
1304
  */
1305
1305
  Grid.prototype._defaultColumnSetup = function (defaultCol, userColumns) {
1306
- var c = userColumns.length;
1307
- for (var i = 0; i < c; i++) {
1308
- var column = userColumns[i];
1306
+ let c = userColumns.length;
1307
+ for (let i = 0; i < c; i++) {
1308
+ let column = userColumns[i];
1309
1309
  if (typeof column === 'object') {
1310
- for (var key in defaultCol) {
1310
+ for (let key in defaultCol) {
1311
1311
  if (column[key] == null) {
1312
1312
  column[key] = defaultCol[key];
1313
1313
  }
@@ -1325,7 +1325,7 @@ Grid.prototype._defaultColumnSetup = function (defaultCol, userColumns) {
1325
1325
  */
1326
1326
  Grid.prototype._processExtension = function (exts, field, params) {
1327
1327
  if(Array.isArray(exts)) {
1328
- for (var i = 0; i < exts.length; i++) {
1328
+ for (let i = 0; i < exts.length; i++) {
1329
1329
  if (exts[i][field]) {
1330
1330
  exts[i][field].apply(exts[i], params);
1331
1331
  }
@@ -1337,15 +1337,15 @@ Grid.prototype._processExtension = function (exts, field, params) {
1337
1337
  * @param {Object} e
1338
1338
  */
1339
1339
  Grid.prototype._onRicAdded = function(e) {
1340
- var addedRics = e.addedRics;
1340
+ let addedRics = e.addedRics;
1341
1341
  this._snapshot.addFields(e.fields);
1342
- var len = addedRics.length;
1343
- for (var i = 0; i < len; ++i) {
1344
- var ric = addedRics[i];
1345
- var rowDefs = this._connector.getRowDefByRic(ric);
1346
- var jLen = rowDefs ? rowDefs.length : 0;
1347
- for (var j = 0; j < jLen; ++j) {
1348
- var rowDef = rowDefs[j];
1342
+ let len = addedRics.length;
1343
+ for (let i = 0; i < len; ++i) {
1344
+ let ric = addedRics[i];
1345
+ let rowDefs = this._connector.getRowDefByRic(ric);
1346
+ let jLen = rowDefs ? rowDefs.length : 0;
1347
+ for (let j = 0; j < jLen; ++j) {
1348
+ let rowDef = rowDefs[j];
1349
1349
  if (rowDef.getSymbol() === ric) {
1350
1350
  this._snapshot.addRic(ric); // ADC
1351
1351
  }
@@ -1366,18 +1366,18 @@ Grid.prototype._onRicRemoved = function(e) {
1366
1366
  * @param {Object} e
1367
1367
  */
1368
1368
  Grid.prototype._onFieldAdded = function(e) {
1369
- var rowDefs = e.rowDefs;
1370
- var addedFields = e.addedFields;
1369
+ let rowDefs = e.rowDefs;
1370
+ let addedFields = e.addedFields;
1371
1371
 
1372
1372
  // ADC
1373
- for (var i in rowDefs) {
1373
+ for (let i in rowDefs) {
1374
1374
  this._snapshot.addRic(rowDefs[i].getSymbol());
1375
1375
  }
1376
1376
  this._snapshot.addFields(addedFields);
1377
1377
 
1378
1378
  // JET
1379
1379
  if (this._subs) {
1380
- var realtimeFields = addedFields.filter(FieldDefinition.isRealTimeField);
1380
+ let realtimeFields = addedFields.filter(FieldDefinition.isRealTimeField);
1381
1381
  if(realtimeFields.length > 0) {
1382
1382
  this._subs["addFields"](realtimeFields);
1383
1383
  }
@@ -1389,7 +1389,7 @@ Grid.prototype._onFieldAdded = function(e) {
1389
1389
  * @param {Object} e
1390
1390
  */
1391
1391
  Grid.prototype._onFieldRemoved = function(e) {
1392
- var removedFields = e.removedFields;
1392
+ let removedFields = e.removedFields;
1393
1393
 
1394
1394
  // TODO: ADC fields have an interval load. Currently, we only keep the field but do not delete it.
1395
1395
  // JET
@@ -1405,19 +1405,19 @@ Grid.prototype._onFieldRemoved = function(e) {
1405
1405
  * @param {number=} idx
1406
1406
  */
1407
1407
  Grid.prototype.insertColumn = function (columnOption, idx) {
1408
- var colCount = this.getColumnCount();
1408
+ let colCount = this.getColumnCount();
1409
1409
  if(idx == null || idx > colCount) {
1410
1410
  idx = colCount;
1411
1411
  }
1412
1412
 
1413
1413
  // no need to merge defaultColumn during initialize process
1414
1414
  // because columnOption already mutate by initialize function
1415
- var configObj = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
1415
+ let configObj = (this._initializing) ? {} : cloneObject(this._defaultColumnOptions);
1416
1416
 
1417
1417
  if (typeof columnOption === "string") {
1418
1418
  configObj["field"] = columnOption;
1419
1419
  } else { // columnOption is assumed to be an object
1420
- for (var key in columnOption) {
1420
+ for (let key in columnOption) {
1421
1421
  configObj[key] = columnOption[key];
1422
1422
  }
1423
1423
  }
@@ -1426,7 +1426,7 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
1426
1426
  configObj["formulaEngine"] = this._fnEngine; // Adding extra option
1427
1427
  }
1428
1428
 
1429
- var colDef = new ColumnDefinition(configObj, this);
1429
+ let colDef = new ColumnDefinition(configObj, this);
1430
1430
  configObj[COL_DEF] = colDef;
1431
1431
 
1432
1432
  // WARNING: width is processed twice by tr-grid and rt-grid
@@ -1439,18 +1439,18 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
1439
1439
  * @param {Object} e snapshort change event object
1440
1440
  */
1441
1441
  Grid.prototype._updateTimeSeriesFields = function (e) {
1442
- var childField;
1443
- var snapShotData = e.data;
1444
- var childFields = {};
1445
- for (var ric in snapShotData) {
1442
+ let childField;
1443
+ let snapShotData = e.data;
1444
+ let childFields = {};
1445
+ for (let ric in snapShotData) {
1446
1446
  // childFields = snapShotData[ric];
1447
1447
  for (childField in snapShotData[ric]) {
1448
1448
  childFields[childField] = true; // Merge child fields to parent (Don't truth each ric it will be have some empty data)
1449
1449
  }
1450
1450
  this.setRicData(ric, snapShotData[ric]); // update cell data if exist
1451
1451
  }
1452
- var parentField, field, colIndex, parentColDef, childColIndex;
1453
- var parentMap = {}; // map parent time series field and their first child
1452
+ let parentField, field, colIndex, parentColDef, childColIndex;
1453
+ let parentMap = {}; // map parent time series field and their first child
1454
1454
  for (field in childFields) { // Warning: data change can be differ time series child field
1455
1455
  parentField = e.childrenFieldToParent[field];
1456
1456
  if(!parentMap[parentField]) {
@@ -1461,10 +1461,10 @@ Grid.prototype._updateTimeSeriesFields = function (e) {
1461
1461
  }
1462
1462
 
1463
1463
  for (parentField in parentMap) { // WARNING: one dataChanged event can be multiple fields
1464
- var childrenField = parentMap[parentField];
1464
+ let childrenField = parentMap[parentField];
1465
1465
  colIndex = this.getColumnIndex(parentField);
1466
1466
  parentColDef = this._getColumnDefinition(colIndex);
1467
- var i, len;
1467
+ let i, len;
1468
1468
  len = childrenField.length;
1469
1469
  for (i = 0; i < len; i++) {
1470
1470
  childField = childrenField[i];
@@ -1490,8 +1490,8 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
1490
1490
  return;
1491
1491
  }
1492
1492
 
1493
- var colDefs = this._timeSeriesChildConflator.popAllData();
1494
- var i, j, len, childField, idx;
1493
+ let colDefs = this._timeSeriesChildConflator.popAllData();
1494
+ let i, j, len, childField, idx;
1495
1495
 
1496
1496
  for (i = 0; i < colDefs.length; i++) {
1497
1497
  colDef = colDefs[i];
@@ -1500,8 +1500,8 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
1500
1500
  if(!colDef) {
1501
1501
  continue;
1502
1502
  }
1503
- var parentField = colDef.getField();
1504
- var childFields = FieldDefinition.getTimeSeriesChildren(parentField);
1503
+ let parentField = colDef.getField();
1504
+ let childFields = FieldDefinition.getTimeSeriesChildren(parentField);
1505
1505
  if(!childFields) { // not found time series field
1506
1506
  return;
1507
1507
  }
@@ -1526,7 +1526,7 @@ Grid.prototype._populateTimeSeriesChildren = function (colDef) {
1526
1526
  * @param {number} idx index of insertion column
1527
1527
  */
1528
1528
  Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx) {
1529
- var parentConfig, columnOption;
1529
+ let parentConfig, columnOption;
1530
1530
  parentConfig = parentColDef.getConfigObject();
1531
1531
  columnOption = cloneObject(parentConfig);
1532
1532
  columnOption["field"] = childField.replace("TR.", ""); // We need to remove the 'TR' prefix from the field to avoid confusion with time series fields.
@@ -1543,15 +1543,15 @@ Grid.prototype._cloneTimeSeriesColumn = function (parentColDef, childField, idx)
1543
1543
  * @param {Grid~ColumnReference} colRef
1544
1544
  */
1545
1545
  Grid.prototype.replaceColumn = function (columnOption, colRef) {
1546
- var colIndex = this.getColumnIndex(colRef);
1546
+ let colIndex = this.getColumnIndex(colRef);
1547
1547
  if(colIndex < 0) {
1548
1548
  return;
1549
1549
  }
1550
- var colConfig = {};
1551
- var core = this._grid;
1552
- var columnDef = core._getColumnDef(colIndex);
1550
+ let colConfig = {};
1551
+ let core = this._grid;
1552
+ let columnDef = core._getColumnDef(colIndex);
1553
1553
 
1554
- var value = core.getColumnScalability(colIndex);
1554
+ let value = core.getColumnScalability(colIndex);
1555
1555
  colConfig["scalable"] = value;
1556
1556
 
1557
1557
  value = core.getColumnCustomLaneSize(colIndex);
@@ -1585,7 +1585,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
1585
1585
  if(typeof columnOption === "string") {
1586
1586
  colConfig["field"] = columnOption;
1587
1587
  } else { // type object from user
1588
- for (var key in columnOption) {
1588
+ for (let key in columnOption) {
1589
1589
  colConfig[key] = columnOption[key];
1590
1590
  }
1591
1591
  }
@@ -1598,7 +1598,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
1598
1598
  colConfig["width"] = 1;
1599
1599
  }
1600
1600
 
1601
- var colDef = this.getColumnDefinition(colIndex);
1601
+ let colDef = this.getColumnDefinition(colIndex);
1602
1602
  if(colDef && colConfig.id == null) {
1603
1603
  colConfig.id = colDef.getId(); // retain ID
1604
1604
  }
@@ -1616,7 +1616,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
1616
1616
  */
1617
1617
  Grid.prototype._onFieldLoadedSuccess = function (field, colDef, response) {
1618
1618
  if (response && response.id) {
1619
- var fieldDef = response;
1619
+ let fieldDef = response;
1620
1620
  if (colDef && colDef.getField() === field) {
1621
1621
  if (colDef.isDefaultName() && fieldDef.name) {
1622
1622
  colDef.setName(fieldDef.name);
@@ -1642,7 +1642,7 @@ Grid.prototype._onFieldLoadedError = function (err) {
1642
1642
  Grid.prototype._onFieldLoaded = function (field, referrer) {
1643
1643
  // For time series, we need to wait until the field is loadedm, then we can insert a child from the field data.
1644
1644
  if(FieldDefinition.isTimeSeries(field)) {
1645
- var colDef = this.getColumnDefinitionById(referrer); // The 'referrer' is a column ID that was just added
1645
+ let colDef = this.getColumnDefinitionById(referrer); // The 'referrer' is a column ID that was just added
1646
1646
  this._populateTimeSeriesChildren(colDef);
1647
1647
  }
1648
1648
  this._connector.addFields(field, referrer);
@@ -1679,14 +1679,14 @@ Grid.prototype.getFieldInfo = function(field) {
1679
1679
  * @param {string} field
1680
1680
  * @return {Promise}
1681
1681
  * @example
1682
- * var gridConfig = {
1682
+ * let gridConfig = {
1683
1683
  * synapse: { // define synapse configuration
1684
1684
  * apiKey: "xxx",
1685
1685
  * contextApp: "xxx",
1686
1686
  * auth: "xxx" (optional)
1687
1687
  * }
1688
1688
  * };
1689
- * var promise = grid.loadFieldInfo("CF_LAST");
1689
+ * let promise = grid.loadFieldInfo("CF_LAST");
1690
1690
  */
1691
1691
  Grid.prototype.loadFieldInfo = function(field) {
1692
1692
  return FieldDefinition.loadFieldInfo(field);
@@ -1699,7 +1699,7 @@ Grid.prototype.loadFieldInfo = function(field) {
1699
1699
  */
1700
1700
  Grid.prototype._shouldLoadFieldInfo = function (field) {
1701
1701
 
1702
- var val = this._RTK || window["JET"]; // Fastest checking can be performed by checking the first condition.
1702
+ let val = this._RTK || window["JET"]; // Fastest checking can be performed by checking the first condition.
1703
1703
  if(!val) {
1704
1704
  return false;
1705
1705
  }
@@ -1726,17 +1726,17 @@ Grid.prototype._shouldLoadFieldInfo = function (field) {
1726
1726
  * @param {Array.<Object>} columns Array of column options
1727
1727
  */
1728
1728
  Grid.prototype.setColumns = function(columns) {
1729
- var grid = this._grid;
1730
- var colCount = (columns) ? columns.length : 0;
1729
+ let grid = this._grid;
1730
+ let colCount = (columns) ? columns.length : 0;
1731
1731
 
1732
1732
  grid.startBatch("reset");
1733
1733
  this.removeAllColumns();
1734
1734
  if(colCount > 0) {
1735
- var prevState = false;
1735
+ let prevState = false;
1736
1736
  if(colCount > 1) {
1737
1737
  prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
1738
1738
  }
1739
- for(var i = 0; i < colCount; ++i) {
1739
+ for(let i = 0; i < colCount; ++i) {
1740
1740
  this.insertColumn(columns[i], i);
1741
1741
  }
1742
1742
  if(colCount > 1) {
@@ -1753,20 +1753,20 @@ Grid.prototype.setColumns = function(columns) {
1753
1753
  * @param {boolean=} byId=false, if enable it, this method will only check for differences in the 'id' property
1754
1754
  */
1755
1755
  Grid.prototype.restoreColumns = function(columns, byId) {
1756
- var grid = this._grid;
1756
+ let grid = this._grid;
1757
1757
  grid.startBatch("reset");
1758
- var configObj = this.getConfigObject();
1759
- var previousColumns = configObj.columns;
1758
+ let configObj = this.getConfigObject();
1759
+ let previousColumns = configObj.columns;
1760
1760
 
1761
- var preColLen = previousColumns.length;
1762
- var newColLen = columns.length;
1761
+ let preColLen = previousColumns.length;
1762
+ let newColLen = columns.length;
1763
1763
 
1764
- var compareLogic = byId ? _hasMatchingId : deepEqual;
1765
- var removingFields = [];
1766
- var keepingColumns = [];
1767
- var columnOrdering = [];
1764
+ let compareLogic = byId ? _hasMatchingId : deepEqual;
1765
+ let removingFields = [];
1766
+ let keepingColumns = [];
1767
+ let columnOrdering = [];
1768
1768
 
1769
- var i, j, found;
1769
+ let i, j, found;
1770
1770
  // Slow, time complexity BigO(n ^ 2)
1771
1771
  for (i = 0; i < preColLen; i++) {
1772
1772
  found = false;
@@ -1784,8 +1784,8 @@ Grid.prototype.restoreColumns = function(columns, byId) {
1784
1784
 
1785
1785
  this.removeColumns(removingFields);
1786
1786
 
1787
- var keepingLen = keepingColumns.length;
1788
- var prevState = false;
1787
+ let keepingLen = keepingColumns.length;
1788
+ let prevState = false;
1789
1789
  if(newColLen > 1) {
1790
1790
  prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
1791
1791
  }
@@ -1794,7 +1794,7 @@ Grid.prototype.restoreColumns = function(columns, byId) {
1794
1794
  for (j = 0; j < keepingLen; j++) { // loop only keeping column
1795
1795
  if(compareLogic(columns[i], keepingColumns[j])) {
1796
1796
  found = true;
1797
- var colIndex = this.getColumnIndex(columns[i].id || 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.
1797
+ let colIndex = this.getColumnIndex(columns[i].id || 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.
1798
1798
  columnOrdering.push(this.getColumnId(colIndex));
1799
1799
  break;
1800
1800
  }
@@ -1825,27 +1825,27 @@ Grid.prototype.setFields = Grid.prototype.setColumns;
1825
1825
  * @param {Object} e
1826
1826
  */
1827
1827
  Grid.prototype._onColumnAdded = function(e) {
1828
- var colDef = /** @type{ColumnDefinition} */(e.context[COL_DEF]);
1828
+ let colDef = /** @type{ColumnDefinition} */(e.context[COL_DEF]);
1829
1829
  delete e.context[COL_DEF];
1830
- var idx = e.colIndex;
1830
+ let idx = e.colIndex;
1831
1831
 
1832
- var coreColDef = this._grid._getColumnDef(idx);
1832
+ let coreColDef = this._grid._getColumnDef(idx);
1833
1833
  colDef._setCoreColumnDef(coreColDef); // For column id and field
1834
1834
 
1835
- var colData = this._grid.getColumnData(idx);
1835
+ let colData = this._grid.getColumnData(idx);
1836
1836
  if(!colData) { // Save column inside grid
1837
1837
  colData = this._grid.setColumnData(idx, {});
1838
1838
  }
1839
1839
  colData[COL_DEF] = colDef;
1840
- var userModel = colDef.getUserModel();
1840
+ let userModel = colDef.getUserModel();
1841
1841
  // binding
1842
1842
  this._grid.setColumnDataBindingHandler(idx, colDef.getRenderer());
1843
1843
  // width and scalable
1844
- var value = userModel["width"];
1844
+ let value = userModel["width"];
1845
1845
  // eslint-disable-next-line no-undefined
1846
1846
  if(value !== undefined) {
1847
1847
  value = +value;
1848
- var scalable;
1848
+ let scalable;
1849
1849
  if(userModel["scalable"] != null) {
1850
1850
  scalable = userModel["scalable"] ? true : false;
1851
1851
  } else {
@@ -1881,16 +1881,16 @@ Grid.prototype._onColumnAdded = function(e) {
1881
1881
  }
1882
1882
 
1883
1883
  // className
1884
- var i, classes = colDef.getClasses();
1884
+ let i, classes = colDef.getClasses();
1885
1885
  for(i = 0; i < classes.length; i++) {
1886
1886
  this._grid.enableColumnClass(idx, classes[i]);
1887
1887
  }
1888
- var colField = colDef.getField();
1888
+ let colField = colDef.getField();
1889
1889
  this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
1890
- var fields = colDef.getAllFields();
1891
- var referrer = colDef.getId();
1892
- var len = fields.length;
1893
- var field, dataType, prom, onLoaded;
1890
+ let fields = colDef.getAllFields();
1891
+ let referrer = colDef.getId();
1892
+ let len = fields.length;
1893
+ let field, dataType, prom, onLoaded;
1894
1894
  for(i = 0; i < len; i++) {
1895
1895
  field = fields[i];
1896
1896
  if(this._shouldLoadFieldInfo(field)) {
@@ -1928,12 +1928,12 @@ Grid.prototype._onColumnAdded = function(e) {
1928
1928
  * @see {@link Grid#removeAllColumns}
1929
1929
  */
1930
1930
  Grid.prototype.removeColumn = function(colRef) {
1931
- var colIndex = this.getColumnIndex(colRef);
1931
+ let colIndex = this.getColumnIndex(colRef);
1932
1932
  if(colIndex < 0) {
1933
1933
  return;
1934
1934
  }
1935
1935
 
1936
- var colDef = this.getColumnDefinition(colIndex);
1936
+ let colDef = this.getColumnDefinition(colIndex);
1937
1937
 
1938
1938
  if(!colDef.isRealTimeField()) {
1939
1939
  if(this._dc) {
@@ -1954,8 +1954,8 @@ Grid.prototype.removeColumn = function(colRef) {
1954
1954
  * @see {@link Grid#removeAllColumns}
1955
1955
  */
1956
1956
  Grid.prototype.removeColumns = function(colRefs) {
1957
- var indices = this.getColumnIndices(colRefs);
1958
- var len = indices.length;
1957
+ let indices = this.getColumnIndices(colRefs);
1958
+ let len = indices.length;
1959
1959
  if(len <= 1) {
1960
1960
  if(len === 1) {
1961
1961
  this.removeColumn(indices[0]);
@@ -1964,12 +1964,12 @@ Grid.prototype.removeColumns = function(colRefs) {
1964
1964
  }
1965
1965
  indices.sort(Grid._descendingOrder); // Removal must be done from the back
1966
1966
 
1967
- var staticFields = []; // For clearing any data stored in our cache
1968
- var prevState = this._grid.freezeLayout(); // To prevent multiple UI updates
1967
+ let staticFields = []; // For clearing any data stored in our cache
1968
+ let prevState = this._grid.freezeLayout(); // To prevent multiple UI updates
1969
1969
 
1970
- for(var i = 0; i < len; ++i) {
1971
- var colIndex = indices[i];
1972
- var colDef = this.getColumnDefinition(colIndex);
1970
+ for(let i = 0; i < len; ++i) {
1971
+ let colIndex = indices[i];
1972
+ let colDef = this.getColumnDefinition(colIndex);
1973
1973
  if(!colDef.isRealTimeField()) {
1974
1974
  staticFields.push(colDef.getField());
1975
1975
  }
@@ -1991,7 +1991,7 @@ Grid.prototype.removeColumns = function(colRefs) {
1991
1991
  * @see {@link Grid#removeColumns}
1992
1992
  */
1993
1993
  Grid.prototype.removeAllColumns = function() {
1994
- var colCount = this.getColumnCount();
1994
+ let colCount = this.getColumnCount();
1995
1995
  if(colCount <= 0) {
1996
1996
  return;
1997
1997
  }
@@ -1999,10 +1999,10 @@ Grid.prototype.removeAllColumns = function() {
1999
1999
  if(!this._sharedSorter) {
2000
2000
  this.clearSort();
2001
2001
  }
2002
- for(var i = colCount; --i >= 0;) {
2002
+ for(let i = colCount; --i >= 0;) {
2003
2003
  // WARNING: This may affect plugins event listeners
2004
2004
  this._grid.setColumnDataBindingHandler(i, null);
2005
- var colDef = this.getColumnDefinition(i);
2005
+ let colDef = this.getColumnDefinition(i);
2006
2006
  colDef.dispose();
2007
2007
  }
2008
2008
  // TODO: Remove fields that are related to the column (e.g. fields for coloring)
@@ -2062,7 +2062,7 @@ Grid.prototype.reorderColumns = function (colRefs, destCol) {
2062
2062
  * @see {@link Grid#showAllColumns}
2063
2063
  */
2064
2064
  Grid.prototype.hideColumn = function(colRef, hidden) {
2065
- var colIndex = this.getColumnIndex(colRef);
2065
+ let colIndex = this.getColumnIndex(colRef);
2066
2066
  if(colIndex < 0) { // not found
2067
2067
  return;
2068
2068
  }
@@ -2107,9 +2107,9 @@ Grid.prototype.addDataFields = function(fieldRef, referrer) {
2107
2107
  return false;
2108
2108
  }
2109
2109
 
2110
- var fields = Array.isArray(fieldRef) ? fieldRef : [fieldRef];
2111
- var len = fields.length;
2112
- var i, field, dataType, prom, onLoaded;
2110
+ let fields = Array.isArray(fieldRef) ? fieldRef : [fieldRef];
2111
+ let len = fields.length;
2112
+ let i, field, dataType, prom, onLoaded;
2113
2113
  for(i = 0; i < len; i++) {
2114
2114
  field = fields[i];
2115
2115
  if(this._shouldLoadFieldInfo(field)) {
@@ -2166,7 +2166,7 @@ Grid.prototype.sortColumn = function(colRef, opt_order) {
2166
2166
  return;
2167
2167
  }
2168
2168
 
2169
- var colIndex = this.getColumnIndex(colRef);
2169
+ let colIndex = this.getColumnIndex(colRef);
2170
2170
  if(colIndex < 0) {
2171
2171
  this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
2172
2172
  } else {
@@ -2178,7 +2178,7 @@ Grid.prototype.sortColumn = function(colRef, opt_order) {
2178
2178
  * @param {string} str
2179
2179
  */
2180
2180
  Grid.prototype.setColumnName = function(colIndex, str) {
2181
- var colDef = this.getColumnDefinition(colIndex);
2181
+ let colDef = this.getColumnDefinition(colIndex);
2182
2182
  if(colDef) {
2183
2183
  colDef.setName(str);
2184
2184
  this.updateColumnTitle();
@@ -2189,7 +2189,7 @@ Grid.prototype.setColumnName = function(colIndex, str) {
2189
2189
  * @param {Function=} func
2190
2190
  */
2191
2191
  Grid.prototype.setColumnRenderer = function(colRef, func) {
2192
- var colIndex = this.getColumnIndex(colRef);
2192
+ let colIndex = this.getColumnIndex(colRef);
2193
2193
  this.setColumnFormatter(colIndex, func);
2194
2194
  };
2195
2195
 
@@ -2199,10 +2199,10 @@ Grid.prototype.setColumnRenderer = function(colRef, func) {
2199
2199
  * @param {Function=} func If not specified the renderer which corresponded id from mapping will be picked up
2200
2200
  */
2201
2201
  Grid.prototype.activateColumnRenderer = function(colRef, id, func) {
2202
- var colIndex = this.getColumnIndex(colRef);
2202
+ let colIndex = this.getColumnIndex(colRef);
2203
2203
  if (colIndex == null) { return; }
2204
2204
 
2205
- var colDef = this.getColumnDefinition(colIndex);
2205
+ let colDef = this.getColumnDefinition(colIndex);
2206
2206
  if(!colDef) { return; }
2207
2207
 
2208
2208
  colDef.activateRenderer(id, func);
@@ -2219,12 +2219,12 @@ Grid.prototype.activateColumnRenderer = function(colRef, id, func) {
2219
2219
  Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
2220
2220
  if (colIndex == null) { return; }
2221
2221
 
2222
- var colDef = this.getColumnDefinition(colIndex);
2222
+ let colDef = this.getColumnDefinition(colIndex);
2223
2223
  if(!colDef) {
2224
2224
  return;
2225
2225
  }
2226
2226
 
2227
- var func = null;
2227
+ let func = null;
2228
2228
  if (formatter) {
2229
2229
  if(typeof formatter === "object") {
2230
2230
  if(typeof formatter.init === "function") { // Initialize predefined formatter
@@ -2241,8 +2241,8 @@ Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
2241
2241
  }
2242
2242
 
2243
2243
  if(func !== colDef.getRenderer()) {
2244
- var section = this._grid.getSection("content");
2245
- var col = /** @type {Column} */section.getColumn(colIndex);
2244
+ let section = this._grid.getSection("content");
2245
+ let col = /** @type {Column} */section.getColumn(colIndex);
2246
2246
  if (col) {
2247
2247
  col.clearContent();
2248
2248
  }
@@ -2261,12 +2261,12 @@ Grid.prototype.setColumnFormatter = function (colIndex, formatter) {
2261
2261
  * @param {ColumnDefinition~SortLogic=} func
2262
2262
  */
2263
2263
  Grid.prototype.setColumnSorter = function(colRef, func) {
2264
- var colIndex = this.getColumnIndex(colRef);
2265
- var colDef = this.getColumnDefinition(colIndex);
2264
+ let colIndex = this.getColumnIndex(colRef);
2265
+ let colDef = this.getColumnDefinition(colIndex);
2266
2266
  if(colDef) {
2267
2267
  colDef.setSorter(func);
2268
2268
 
2269
- var sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
2269
+ let sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
2270
2270
  if(sortedColumn === colIndex) {
2271
2271
  this._stp.refresh();
2272
2272
  }
@@ -2279,8 +2279,8 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
2279
2279
  * @param {RowDefinition} rowDef
2280
2280
  */
2281
2281
  Grid.prototype._initDuplicateRicData = function(rowDef) {
2282
- var ric = rowDef.getSymbol();
2283
- var rowDefs = this._connector.getRowDefByRic(ric);
2282
+ let ric = rowDef.getSymbol();
2283
+ let rowDefs = this._connector.getRowDefByRic(ric);
2284
2284
  if(rowDefs && rowDefs.length) {
2285
2285
  cloneRowData(rowDefs[0], rowDef);
2286
2286
  }
@@ -2290,7 +2290,7 @@ Grid.prototype._initDuplicateRicData = function(rowDef) {
2290
2290
  * @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
2291
2291
  * @returns {RowDefinition}
2292
2292
  * @example
2293
- * var grid = new rt.Grid(grid_div, options);
2293
+ * let grid = new rt.Grid(grid_div, options);
2294
2294
  * grid.insertRow({"ric": "RIC"}, 0); // A new row is added at the top
2295
2295
  */
2296
2296
  Grid.prototype.insertRow = function(rowOption, rowRef) {
@@ -2307,7 +2307,7 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
2307
2307
  }
2308
2308
  }
2309
2309
  }
2310
- var rowDef = new RowDefinition(rowOption);
2310
+ let rowDef = new RowDefinition(rowOption);
2311
2311
  rowDef.setDataSource(this._dc); // This could also subscribe chain index/ric to JET/RTK
2312
2312
  this._initDuplicateRicData(rowDef);
2313
2313
 
@@ -2323,7 +2323,7 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
2323
2323
  * @param {Grid~RowReference=} rowRef Reference (i.e. row index, row id, or row definition) of the insert position
2324
2324
  * @param {Array.<string>=} opt_fields
2325
2325
  * @example
2326
- * var grid = new rt.Grid(grid_div, options);
2326
+ * let grid = new rt.Grid(grid_div, options);
2327
2327
  * grid.insertRows([
2328
2328
  * {ric: "RIC"},
2329
2329
  * {values: {"field1": 0, "field2": 1}},
@@ -2340,12 +2340,12 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
2340
2340
  return;
2341
2341
  }
2342
2342
 
2343
- var prevState = this._dt.freeze(); // Avoid sorting for each inserted row
2344
- var fields = opt_fields || this.getColumnFields();
2345
- var rowId = this._getRowId(rowRef);
2346
- var len = rowOptions.length;
2347
- for(var r = 0; r < len; ++r) {
2348
- var rowOption = rowOptions[r];
2343
+ let prevState = this._dt.freeze(); // Avoid sorting for each inserted row
2344
+ let fields = opt_fields || this.getColumnFields();
2345
+ let rowId = this._getRowId(rowRef);
2346
+ let len = rowOptions.length;
2347
+ for(let r = 0; r < len; ++r) {
2348
+ let rowOption = rowOptions[r];
2349
2349
  if(rowOption) {
2350
2350
  if(typeof rowOption === "string") {
2351
2351
  rowOption = { "ric": rowOption };
@@ -2363,7 +2363,7 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
2363
2363
  * @see {@link Grid#logDV}
2364
2364
  * @see {@link Grid#logDT}
2365
2365
  * @example
2366
- * var grid = new rt.Grid(grid_div, options);
2366
+ * let grid = new rt.Grid(grid_div, options);
2367
2367
  * grid.addStaticDataRows([
2368
2368
  * [10, "a", true],
2369
2369
  * [20, "b", false],
@@ -2384,7 +2384,7 @@ Grid.prototype.addStaticDataRows = function(dataRows, fields) {
2384
2384
  }
2385
2385
 
2386
2386
  if(!Array.isArray(dataRows)) {
2387
- var userObj = dataRows;
2387
+ let userObj = dataRows;
2388
2388
  dataRows = null;
2389
2389
  if(userObj) {
2390
2390
  if(userObj.fields && !fields) {
@@ -2448,13 +2448,15 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2448
2448
  }
2449
2449
 
2450
2450
  // Map new data index
2451
- var recordCount = records.length;
2452
- var fieldSorting = "ROW_ORDER"; // TODO: Should be config by options
2453
- var oldDataMap = {};
2454
- var rowDef, id, record, i;
2455
- var rowDefs = this.getAllRowDefinitions(); // Include the filter/hidden rows
2456
- var rowDefCount = rowDefs.length;
2451
+ let recordCount = records.length;
2452
+ let fieldSorting = "ROW_ORDER"; // TODO: Should be config by options
2453
+ let oldDataMap = {};
2454
+ let rowDef, id, record, i;
2455
+ let rowDefs = this.getAllRowDefinitions(); // Include the filter/hidden rows
2456
+ let rowDefCount = rowDefs.length;
2457
+ let prevState = false;
2457
2458
  if(rowIdentifier) {
2459
+ prevState = this._dt.freeze();
2458
2460
  for (i = 0; i < rowDefCount; i++) {
2459
2461
  rowDef = rowDefs[i];
2460
2462
  if(rowDef) {
@@ -2467,8 +2469,8 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2467
2469
  }
2468
2470
  }
2469
2471
 
2470
- var idMap = {};
2471
- var newDataMap = {};
2472
+ let idMap = {};
2473
+ let newDataMap = {};
2472
2474
  for (i = recordCount - 1; i >= 0; i--) {
2473
2475
  record = records[i];
2474
2476
  id = record[rowIdentifier];
@@ -2486,13 +2488,17 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2486
2488
  }
2487
2489
  }
2488
2490
  // Check Remove previous data
2489
- for (var rowIdentifierName in oldDataMap) {
2491
+ for (let rowIdentifierName in oldDataMap) {
2490
2492
  if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
2491
2493
  this.removeRow(oldDataMap[rowIdentifierName]); // Slow
2492
2494
  }
2493
2495
  }
2494
2496
  this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
2497
+ this._dt.freeze(prevState);
2495
2498
  } else {
2499
+ if(recordCount - rowDefCount > 1 || rowDefCount - recordCount > 1) {
2500
+ prevState = this._dt.freeze();
2501
+ }
2496
2502
  for (i = 0; i < rowDefCount; i++) {
2497
2503
  record = records[i];
2498
2504
  if(record) {
@@ -2511,6 +2517,9 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2511
2517
  rowDef.setRowData(record);
2512
2518
  }
2513
2519
  }
2520
+ if(recordCount - rowDefCount > 1 || rowDefCount - recordCount > 1) {
2521
+ this._dt.freeze(prevState);
2522
+ }
2514
2523
  }
2515
2524
  };
2516
2525
  /** @private
@@ -2530,7 +2539,7 @@ Grid.prototype.removeRow = function(rowRef) {
2530
2539
  if(this._mainGrid) {
2531
2540
  return this._mainGrid.removeRow(this._getRowId(rowRef));
2532
2541
  }
2533
- var rowDef = this._getRowDefinitionByRef(rowRef);
2542
+ let rowDef = this._getRowDefinitionByRef(rowRef);
2534
2543
  if(rowDef) {
2535
2544
  if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
2536
2545
  this._removeRow(rowDef);
@@ -2546,7 +2555,7 @@ Grid.prototype.removeRow = function(rowRef) {
2546
2555
  * @see {@link Grid#removeAllRows}
2547
2556
  */
2548
2557
  Grid.prototype.removeRows = function(rowRefs) {
2549
- var rowDef;
2558
+ let rowDef;
2550
2559
  if(!Array.isArray(rowRefs)) {
2551
2560
  rowDef = this.removeRow(rowRefs);
2552
2561
  return rowDef ? [rowDef] : [];
@@ -2555,9 +2564,9 @@ Grid.prototype.removeRows = function(rowRefs) {
2555
2564
  return this._mainGrid.removeRows(rowRefs.map(this._getRowId));
2556
2565
  }
2557
2566
 
2558
- var i;
2559
- var rowDefs = [];
2560
- var len = rowRefs.length;
2567
+ let i;
2568
+ let rowDefs = [];
2569
+ let len = rowRefs.length;
2561
2570
 
2562
2571
  // Verify user input
2563
2572
  for(i = 0; i < len; ++i) {
@@ -2570,7 +2579,7 @@ Grid.prototype.removeRows = function(rowRefs) {
2570
2579
  }
2571
2580
  len = rowDefs.length;
2572
2581
 
2573
- var prevState = false;
2582
+ let prevState = false;
2574
2583
  if(len > 1) {
2575
2584
  prevState = this._dt.freeze(); // Prevent multiple changes that trigger sorting and filtering
2576
2585
  }
@@ -2595,7 +2604,7 @@ Grid.prototype.removeAllRows = function() {
2595
2604
  if(!this._dt.getRowCount()) {
2596
2605
  return;
2597
2606
  }
2598
- var rowDefs = this._getAllRowDefinitions();
2607
+ let rowDefs = this._getAllRowDefinitions();
2599
2608
 
2600
2609
  if(!this._sharedDataSource) {
2601
2610
  this._dc.clearAllData();
@@ -2623,14 +2632,14 @@ Grid.prototype._removeRow = function(rowDef) {
2623
2632
  }
2624
2633
  this._dispatch("beforeRowRemoved", {});
2625
2634
 
2626
- var connector = this._connector;
2627
- var dt = this._dt;
2628
- var childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
2635
+ let connector = this._connector;
2636
+ let dt = this._dt;
2637
+ let childRowDefs = rowDef.getDescendants(); // TODO: Support nested child
2629
2638
  if(childRowDefs) { // Remove all children first
2630
- for(var i = 0; i < childRowDefs.length; i++) {
2639
+ for(let i = 0; i < childRowDefs.length; i++) {
2631
2640
  connector.removeRic(childRowDefs[i]);
2632
2641
  }
2633
- var rowIds = childRowDefs.map(RowDefinition.toRowId);
2642
+ let rowIds = childRowDefs.map(RowDefinition.toRowId);
2634
2643
  dt.removeRows(rowIds);
2635
2644
  }
2636
2645
  connector.removeRic(rowDef);
@@ -2643,8 +2652,8 @@ Grid.prototype._removeRow = function(rowDef) {
2643
2652
  * @param {boolean=} hidden if false, show instead of hide
2644
2653
  */
2645
2654
  Grid.prototype.hideRow = function(rowRef, hidden) {
2646
- var rid = this._getRowId(rowRef);
2647
- var grid = this._mainGrid || this._grid;
2655
+ let rid = this._getRowId(rowRef);
2656
+ let grid = this._mainGrid || this._grid;
2648
2657
  grid.hideRow(rid, hidden);
2649
2658
  };
2650
2659
 
@@ -2657,8 +2666,8 @@ Grid.prototype.hideRows = function (rowRefs, hidden) {
2657
2666
  if (!Array.isArray(rowRefs)) {
2658
2667
  rowRefs = [rowRefs];
2659
2668
  }
2660
- var rids = rowRefs.map(this._getRowId);
2661
- var grid = this._mainGrid || this._grid;
2669
+ let rids = rowRefs.map(this._getRowId);
2670
+ let grid = this._mainGrid || this._grid;
2662
2671
  grid.hideRows(rids, hidden);
2663
2672
  };
2664
2673
  /**
@@ -2696,19 +2705,19 @@ Grid.prototype.setRic = function(rowRef, str, options) {
2696
2705
  this._mainGrid.setRic(this._toRowId(rowRef), str, options);
2697
2706
  return;
2698
2707
  }
2699
- var rowDef = this._getRowDefinitionByRef(rowRef);
2708
+ let rowDef = this._getRowDefinitionByRef(rowRef);
2700
2709
  if(rowDef) {
2701
2710
  options = options || {};
2702
2711
  options["ric"] = str;
2703
- var extractedOptions = RowDefinition.extractRowOptions(options);
2704
- var oldRic = rowDef.getSymbol();
2712
+ let extractedOptions = RowDefinition.extractRowOptions(options);
2713
+ let oldRic = rowDef.getSymbol();
2705
2714
  if(rowDef.setContent(str, extractedOptions)) { // The given string may not be a RIC
2706
2715
  this._connector.removeRic(rowDef, oldRic);
2707
2716
  this._initDuplicateRicData(rowDef);
2708
2717
  this._connector.addRic(rowDef);
2709
2718
  }
2710
2719
 
2711
- var values = options["values"];
2720
+ let values = options["values"];
2712
2721
  if(values != null) {
2713
2722
  rowDef.setStaticRowData(values, options["fields"]);
2714
2723
  }
@@ -2724,7 +2733,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
2724
2733
  * @param {Grid~RowReference} rowRef
2725
2734
  */
2726
2735
  Grid.prototype.unlinkChain = function(rowRef) {
2727
- var rowDef = this._getRowDefinitionByRef(rowRef);
2736
+ let rowDef = this._getRowDefinitionByRef(rowRef);
2728
2737
  if(!rowDef) {
2729
2738
  return;
2730
2739
  }
@@ -2763,7 +2772,7 @@ Grid.prototype._onRowExpansionBinding = function(e) {
2763
2772
  }
2764
2773
 
2765
2774
  if(e["originalRowId"]) {
2766
- var rowIndex = this._dv.getRowIndex(e["originalRowId"]);
2775
+ let rowIndex = this._dv.getRowIndex(e["originalRowId"]);
2767
2776
  e["originalRowDef"] = this._getRowDefinitionByIndex(rowIndex);
2768
2777
  e["originalRowData"] = e["originalRowDef"].getRowData();
2769
2778
  } else {
@@ -2817,7 +2826,7 @@ Grid.prototype.getColumnCount = function() {
2817
2826
  * @return {string}
2818
2827
  */
2819
2828
  Grid.prototype.getColumnDataType = function(colIndex) {
2820
- var colDef = this.getColumnDefinition(colIndex);
2829
+ let colDef = this.getColumnDefinition(colIndex);
2821
2830
  if (colDef) {
2822
2831
  return colDef.getDataType();
2823
2832
  }
@@ -2828,7 +2837,7 @@ Grid.prototype.getColumnDataType = function(colIndex) {
2828
2837
  * @return {ColumnDefinition}
2829
2838
  */
2830
2839
  Grid.prototype.getColumnDefinition = function(colIndex) {
2831
- var colData = this._grid.getColumnData(colIndex);
2840
+ let colData = this._grid.getColumnData(colIndex);
2832
2841
  if(colData) {
2833
2842
  return /** @type{ColumnDefinition} */(colData[COL_DEF]) || null;
2834
2843
  }
@@ -2838,9 +2847,9 @@ Grid.prototype.getColumnDefinition = function(colIndex) {
2838
2847
  * @return {!Array.<ColumnDefinition>}
2839
2848
  */
2840
2849
  Grid.prototype.getColumnDefinitions = function() {
2841
- var colCount = this.getColumnCount();
2842
- var colDefs = new Array(colCount);
2843
- for(var i = 0; i < colCount; i++) {
2850
+ let colCount = this.getColumnCount();
2851
+ let colDefs = new Array(colCount);
2852
+ for(let i = 0; i < colCount; i++) {
2844
2853
  colDefs[i] = this.getColumnDefinition(i);
2845
2854
  }
2846
2855
  return colDefs;
@@ -2862,10 +2871,10 @@ Grid.prototype.getColumnDefinitionById = function(colId) {
2862
2871
  * @return {ColumnDefinition}
2863
2872
  */
2864
2873
  Grid.prototype.getColumnDefinitionsById = function(colIds) {
2865
- var colCount = Array.isArray(colIds) ? colIds.length : 0;
2874
+ let colCount = Array.isArray(colIds) ? colIds.length : 0;
2866
2875
  if(colCount > 0) {
2867
- var i, colId;
2868
- var colDefs = new Array(colCount);
2876
+ let i, colId;
2877
+ let colDefs = new Array(colCount);
2869
2878
  for(i = 0; i < colCount; i++) {
2870
2879
  colId = colIds[i];
2871
2880
  colDefs[i] = this.getColumnDefinitionById(colId);
@@ -2885,9 +2894,9 @@ Grid.prototype._getColumnDefinition = function(colRef) {
2885
2894
  } else if(typeof colRef === "number") {
2886
2895
  return this.getColumnDefinition(colRef);
2887
2896
  } else if(typeof colRef === "string") {
2888
- var colCount = this.getColumnCount();
2889
- for(var i = 0; i < colCount; ++i) {
2890
- var colDef = this.getColumnDefinition(i);
2897
+ let colCount = this.getColumnCount();
2898
+ for(let i = 0; i < colCount; ++i) {
2899
+ let colDef = this.getColumnDefinition(i);
2891
2900
  if(_hasFieldOrId(colDef, colRef)) {
2892
2901
  return colDef; // Return the first found column
2893
2902
  }
@@ -2900,7 +2909,7 @@ Grid.prototype._getColumnDefinition = function(colRef) {
2900
2909
  * @return {string}
2901
2910
  */
2902
2911
  Grid.prototype.getRowType = function(rowRef) {
2903
- var rowDef = this.getRowDefinition(rowRef);
2912
+ let rowDef = this.getRowDefinition(rowRef);
2904
2913
  return rowDef ? rowDef.getType() : "";
2905
2914
  };
2906
2915
  /** Get RowDefinition object by either number or row id
@@ -2992,15 +3001,15 @@ Grid.prototype.getMultipleRowData = function(obj) {
2992
3001
  if(typeof obj === "number") {
2993
3002
  return [this.getRowData(obj)];
2994
3003
  }
2995
- var rowDefs = null;
3004
+ let rowDefs = null;
2996
3005
  if(Array.isArray(obj)) {
2997
- var rowRefs = obj;
2998
- var rowCount = rowRefs.length;
2999
- var rows = new Array(rowCount);
3006
+ let rowRefs = obj;
3007
+ let rowCount = rowRefs.length;
3008
+ let rows = new Array(rowCount);
3000
3009
  rowDefs = this.getRowDefinitions();
3001
3010
 
3002
- for(var r = 0; r < rowCount; ++r) {
3003
- var rowRef = rowRefs[r];
3011
+ for(let r = 0; r < rowCount; ++r) {
3012
+ let rowRef = rowRefs[r];
3004
3013
  if(typeof rowRef === "number") {
3005
3014
  rows[r] = toRowData(rowDefs[rowRef]);
3006
3015
  } else if(rowRef && rowRef.getRowData) {
@@ -3023,10 +3032,10 @@ Grid.prototype.getMultipleRowData = function(obj) {
3023
3032
  * @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
3024
3033
  */
3025
3034
  Grid.prototype.setRicData = function(ric, values) {
3026
- var rowDefs = this._connector.getRowDefByRic(ric);
3027
- var rowCount = rowDefs ? rowDefs.length : 0;
3028
- for (var i = 0; i < rowCount; ++i) {
3029
- var rowDef = rowDefs[i];
3035
+ let rowDefs = this._connector.getRowDefByRic(ric);
3036
+ let rowCount = rowDefs ? rowDefs.length : 0;
3037
+ for (let i = 0; i < rowCount; ++i) {
3038
+ let rowDef = rowDefs[i];
3030
3039
  if (rowDef && rowDef.getSymbol() === ric) {
3031
3040
  rowDef.setRowData(values); // TODO: Need conflator to improve performance
3032
3041
  }
@@ -3038,7 +3047,7 @@ Grid.prototype.setRicData = function(ric, values) {
3038
3047
  * @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
3039
3048
  */
3040
3049
  Grid.prototype.setRowData = function(rowRef, values) {
3041
- var rowDef = this._getRowDefinitionByRef(rowRef);
3050
+ let rowDef = this._getRowDefinitionByRef(rowRef);
3042
3051
  if(rowDef) {
3043
3052
  rowDef.setRowData(values);
3044
3053
  }
@@ -3050,7 +3059,7 @@ Grid.prototype.setRowData = function(rowRef, values) {
3050
3059
  * @param {Object} values
3051
3060
  */
3052
3061
  Grid.prototype.setStaticRowData = function(rowRef, values) {
3053
- var rowDef = this._getRowDefinitionByRef(rowRef);
3062
+ let rowDef = this._getRowDefinitionByRef(rowRef);
3054
3063
  if(rowDef) {
3055
3064
  rowDef.setStaticRowData(values);
3056
3065
  }
@@ -3063,7 +3072,7 @@ Grid.prototype.setStaticRowData = function(rowRef, values) {
3063
3072
  * @param {*} value
3064
3073
  */
3065
3074
  Grid.prototype.setStaticData = function(rowRef, field, value) {
3066
- var rowDef = this._getRowDefinitionByRef(rowRef);
3075
+ let rowDef = this._getRowDefinitionByRef(rowRef);
3067
3076
  if(rowDef) {
3068
3077
  rowDef.setStaticData(field, value);
3069
3078
  }
@@ -3091,9 +3100,9 @@ Grid.prototype._getRowId = function(rowRef) {
3091
3100
  Grid.prototype.getColumnIndex = function(colRef) {
3092
3101
  if(colRef) {
3093
3102
  if(colRef instanceof ColumnDefinition) {
3094
- var colCount = this.getColumnCount();
3095
- for(var i = 0; i < colCount; ++i) {
3096
- var colDef = this.getColumnDefinition(i);
3103
+ let colCount = this.getColumnCount();
3104
+ for(let i = 0; i < colCount; ++i) {
3105
+ let colDef = this.getColumnDefinition(i);
3097
3106
  if(colDef === colRef) {
3098
3107
  return i;
3099
3108
  }
@@ -3109,13 +3118,13 @@ Grid.prototype.getColumnIndex = function(colRef) {
3109
3118
  * @return {!Array.<number>}
3110
3119
  */
3111
3120
  Grid.prototype.getColumnIndices = function(colRefs) {
3112
- var ary = [];
3113
- var colCount = this.getColumnCount();
3114
- var inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
3115
- var len = inputAry.length;
3121
+ let ary = [];
3122
+ let colCount = this.getColumnCount();
3123
+ let inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
3124
+ let len = inputAry.length;
3116
3125
  // Verify user input
3117
- for(var i = 0; i < len; ++i) {
3118
- var colIndex = this.getColumnIndex(inputAry[i]);
3126
+ for(let i = 0; i < len; ++i) {
3127
+ let colIndex = this.getColumnIndex(inputAry[i]);
3119
3128
  if(colIndex >= 0 && colIndex < colCount) {
3120
3129
  ary.push(colIndex); // WARNING: We have not checked for duplication
3121
3130
  }
@@ -3190,11 +3199,11 @@ Grid.prototype.freezeColumn = function(colIndex, pinnedRightColumns) {
3190
3199
  */
3191
3200
  Grid.prototype.pinColumn = function(colRef, side) {
3192
3201
  if(Array.isArray(colRef)) {
3193
- var ary = colRef;
3194
- var len = ary.length;
3202
+ let ary = colRef;
3203
+ let len = ary.length;
3195
3204
 
3196
- var dirty = 0;
3197
- for(var i = 0; i < len; ++i) {
3205
+ let dirty = 0;
3206
+ for(let i = 0; i < len; ++i) {
3198
3207
  dirty |= this._pinColumn(ary[i], side);
3199
3208
  }
3200
3209
  return dirty ? true : false;
@@ -3207,18 +3216,18 @@ Grid.prototype.pinColumn = function(colRef, side) {
3207
3216
  * @return {boolean}
3208
3217
  */
3209
3218
  Grid.prototype._pinColumn = function(colRef, side) {
3210
- var colIndex = this.getColumnIndex(colRef);
3211
- var colCount = this.getColumnCount();
3219
+ let colIndex = this.getColumnIndex(colRef);
3220
+ let colCount = this.getColumnCount();
3212
3221
  if(colIndex < 0 || colIndex > colCount) {
3213
3222
  return false;
3214
3223
  }
3215
3224
 
3216
- var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
3217
- var rightPinnedCount = this._grid.getPinnedRightColumnCount();
3218
- var stationaryIdx = this._grid.getStationaryColumnIndex();
3225
+ let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
3226
+ let rightPinnedCount = this._grid.getPinnedRightColumnCount();
3227
+ let stationaryIdx = this._grid.getStationaryColumnIndex();
3219
3228
 
3220
3229
  if(side && side.toLowerCase() === "right") {
3221
- var rightPinnedIndex = this._grid.getFirstPinnedRightIndex();
3230
+ let rightPinnedIndex = this._grid.getFirstPinnedRightIndex();
3222
3231
  if(colIndex >= rightPinnedIndex) {
3223
3232
  return false; // The column is already pinned area
3224
3233
  }
@@ -3257,11 +3266,11 @@ Grid.prototype._pinColumn = function(colRef, side) {
3257
3266
  */
3258
3267
  Grid.prototype.unpinColumn = function(colRef, dest) {
3259
3268
  if(Array.isArray(colRef)) {
3260
- var ary = colRef;
3261
- var len = ary.length;
3269
+ let ary = colRef;
3270
+ let len = ary.length;
3262
3271
 
3263
- var dirty = 0;
3264
- for(var i = len; --i >= 0;) { // WARNING: unpinning is done in reversed order
3272
+ let dirty = 0;
3273
+ for(let i = len; --i >= 0;) { // WARNING: unpinning is done in reversed order
3265
3274
  dirty |= this._unpinColumn(ary[i], dest);
3266
3275
  }
3267
3276
  return dirty ? true : false;
@@ -3274,29 +3283,29 @@ Grid.prototype.unpinColumn = function(colRef, dest) {
3274
3283
  * @return {boolean}
3275
3284
  */
3276
3285
  Grid.prototype._unpinColumn = function(colRef, dest) {
3277
- var colIndex = this.getColumnIndex(colRef);
3286
+ let colIndex = this.getColumnIndex(colRef);
3278
3287
  if(colIndex < 0) {
3279
3288
  return false;
3280
3289
  }
3281
3290
 
3282
- var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
3283
- var rightPinnedCount = this._grid.getPinnedRightColumnCount();
3284
- var colCount = this.getColumnCount();
3285
- var firstRightPinnedIndex = colCount - rightPinnedCount;
3291
+ let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
3292
+ let rightPinnedCount = this._grid.getPinnedRightColumnCount();
3293
+ let colCount = this.getColumnCount();
3294
+ let firstRightPinnedIndex = colCount - rightPinnedCount;
3286
3295
 
3287
3296
  if(colIndex >= leftPinnedCount && colIndex < firstRightPinnedIndex) {
3288
3297
  return false;
3289
3298
  }
3290
3299
 
3291
- var srcId = null;
3292
- var destId = null;
3300
+ let srcId = null;
3301
+ let destId = null;
3293
3302
  if(dest != null) {
3294
- var destIdx = this.getColumnIndex(dest);
3303
+ let destIdx = this.getColumnIndex(dest);
3295
3304
  destId = this.getColumnId(destIdx);
3296
3305
  srcId = this.getColumnId(colIndex);
3297
3306
  }
3298
3307
 
3299
- var stationaryIdx = this._grid.getStationaryColumnIndex();
3308
+ let stationaryIdx = this._grid.getStationaryColumnIndex();
3300
3309
 
3301
3310
  if(colIndex < leftPinnedCount) {
3302
3311
  if(colIndex > stationaryIdx) {
@@ -3325,8 +3334,8 @@ Grid.prototype._unpinColumn = function(colRef, dest) {
3325
3334
  * @return {boolean}
3326
3335
  */
3327
3336
  Grid.prototype.unpinAllColumns = function() {
3328
- var leftPinnedCount = this._grid.getPinnedLeftColumnCount();
3329
- var rightPinnedCount = this._grid.getPinnedRightColumnCount();
3337
+ let leftPinnedCount = this._grid.getPinnedLeftColumnCount();
3338
+ let rightPinnedCount = this._grid.getPinnedRightColumnCount();
3330
3339
  if(!leftPinnedCount && !rightPinnedCount) {
3331
3340
  return false;
3332
3341
  }
@@ -3342,8 +3351,8 @@ Grid.prototype._onColumnHeaderBinding = function(e) {
3342
3351
  return; // WARNING: Assume that only the first title section is owned by the grid. Anything else is assumed to be generated by plugins
3343
3352
  }
3344
3353
 
3345
- var c = e["fromColIndex"];
3346
- var toC = e["toColIndex"];
3354
+ let c = e["fromColIndex"];
3355
+ let toC = e["toColIndex"];
3347
3356
  while(c < toC) {
3348
3357
  this._renderColumnHeader(c++, e);
3349
3358
  }
@@ -3353,22 +3362,22 @@ Grid.prototype._onColumnHeaderBinding = function(e) {
3353
3362
  * @param {Object} arg
3354
3363
  */
3355
3364
  Grid.prototype._renderColumnHeader = function(colIndex, arg) {
3356
- var colDef = this.getColumnDefinition(colIndex);
3365
+ let colDef = this.getColumnDefinition(colIndex);
3357
3366
  if(!colDef) {
3358
3367
  return;
3359
3368
  }
3360
- var customRenderer = colDef.getHeaderRenderer();
3361
- var tSection = arg.section;
3362
- var rowCount = tSection.getRowCount();
3369
+ let customRenderer = colDef.getHeaderRenderer();
3370
+ let tSection = arg.section;
3371
+ let rowCount = tSection.getRowCount();
3363
3372
  arg["colIndex"] = colIndex;
3364
3373
  arg["columnDef"] = colDef;
3365
3374
 
3366
- var colName = colDef.getName();
3367
- var colTooltip = colDef.getTooltip();
3368
- var headerAlignment = colDef.getHeaderAlignment();
3375
+ let colName = colDef.getName();
3376
+ let colTooltip = colDef.getTooltip();
3377
+ let headerAlignment = colDef.getHeaderAlignment();
3369
3378
 
3370
- for(var r = 0; r < rowCount; ++r) {
3371
- var tCell = tSection.getCell(colIndex, r, false);
3379
+ for(let r = 0; r < rowCount; ++r) {
3380
+ let tCell = tSection.getCell(colIndex, r, false);
3372
3381
  // Default behaviors
3373
3382
  tCell.setContent(colName);
3374
3383
  tCell.setTooltip(colTooltip);
@@ -3387,7 +3396,7 @@ Grid.prototype.updateColumnTitle = function() {
3387
3396
  if(this._columnTitleConflator.conflate()) {
3388
3397
  return;
3389
3398
  }
3390
- var tss = this._grid.getSectionSettings("title"); // WARNING: Assume that only the first title section is owned by the grid
3399
+ let tss = this._grid.getSectionSettings("title"); // WARNING: Assume that only the first title section is owned by the grid
3391
3400
  if(tss) {
3392
3401
  tss.rerender();
3393
3402
  }
@@ -3433,17 +3442,17 @@ Grid.prototype._onQuote2PostUpdate = function (e) {
3433
3442
  * @param {!Object} e
3434
3443
  */
3435
3444
  Grid.prototype._onDataChanged = function(e) {
3436
- var rowData = e["rowData"]; // Use rowData to retrieve corresponding subscription object
3445
+ let rowData = e["rowData"]; // Use rowData to retrieve corresponding subscription object
3437
3446
  if (!rowData) {
3438
3447
  return; // This must be a global change
3439
3448
  }
3440
- var rowDef = rowData[ROW_DEF];
3449
+ let rowDef = rowData[ROW_DEF];
3441
3450
 
3442
3451
  if(rowDef) {
3443
- var rowId = rowDef.getRowId();
3452
+ let rowId = rowDef.getRowId();
3444
3453
  if(rowId) {
3445
3454
  // e["rid"] could be from JET/RTK (rowId + ric) or static data update (rowId)
3446
- var curRowData = this._dc.getRowData(e["rid"]);
3455
+ let curRowData = this._dc.getRowData(e["rid"]);
3447
3456
  if (curRowData) {
3448
3457
  if(rowDef.addUpdate(e)) { // This is the only place that update array can grow. It is used for blinking data.
3449
3458
  this._dt._hasNewUpdates = true; // Mark data table for cleaning it up later
@@ -3458,9 +3467,9 @@ Grid.prototype._onDataChanged = function(e) {
3458
3467
  }
3459
3468
 
3460
3469
  // The new data update has no row definition, meaning that we have found a new constituent from a chain.
3461
- var subId = rowData[SUB_ID]; // The constituent will share the same sub id as its parent
3470
+ let subId = rowData[SUB_ID]; // The constituent will share the same sub id as its parent
3462
3471
  if(subId) {
3463
- var parentDef = this._getRowDefinitionById(subId);
3472
+ let parentDef = this._getRowDefinitionById(subId);
3464
3473
  if(parentDef && parentDef.getRic() !== rowData["RIC"]) { // TODO: Check for delayed ric
3465
3474
  if(!this._chainMembers) {
3466
3475
  this._chainMembers = {};
@@ -3480,21 +3489,21 @@ Grid.prototype._addMemberOfChain = function(rowData) {
3480
3489
  return;
3481
3490
  }
3482
3491
 
3483
- var rows = this._chainConflator.popAllData(); // This must have no duplication
3484
- var len = rows ? rows.length : 0;
3485
- var i;
3492
+ let rows = this._chainConflator.popAllData(); // This must have no duplication
3493
+ let len = rows ? rows.length : 0;
3494
+ let i;
3486
3495
 
3487
- var prevState = false;
3496
+ let prevState = false;
3488
3497
  if(len > 1) {
3489
3498
  prevState = this._dt.freeze(); // Avoid sorting for each insertion
3490
3499
  }
3491
- var childDefs = [];
3500
+ let childDefs = [];
3492
3501
  for(i = 0; i < len; ++i) {
3493
3502
  rowData = /** @type{!Object} */(rows[i]);
3494
- var subId = rowData[SUB_ID];
3495
- var parentDef = this._getRowDefinitionById(subId);
3503
+ let subId = rowData[SUB_ID];
3504
+ let parentDef = this._getRowDefinitionById(subId);
3496
3505
  if(parentDef) {
3497
- var childDef = parentDef.addConstituent(/** @type{string} */(rowData["RIC"]), this._dt);
3506
+ let childDef = parentDef.addConstituent(/** @type{string} */(rowData["RIC"]), this._dt);
3498
3507
  if(childDef) {
3499
3508
  childDefs.push(childDef);
3500
3509
  } // else { // childDef has already been added
@@ -3502,7 +3511,7 @@ Grid.prototype._addMemberOfChain = function(rowData) {
3502
3511
  }
3503
3512
  this._chainMembers = null; // Clear all waiting chain members
3504
3513
 
3505
- var childCount = childDefs.length;
3514
+ let childCount = childDefs.length;
3506
3515
  if(childCount) {
3507
3516
  for(i = childCount; --i >= 0;) {
3508
3517
  this._connector.addRic(childDefs[i]); // TODO: JET/RTK should not re-subscribe this
@@ -3530,19 +3539,19 @@ Grid.prototype._updateStreamingData = function() {
3530
3539
  * @param {Object} e
3531
3540
  */
3532
3541
  Grid.prototype._onPreDataSorting = function (e) {
3533
- var objs = this._stp.getSortedColumns();
3542
+ let objs = this._stp.getSortedColumns();
3534
3543
 
3535
3544
  this._sorter.reset();
3536
3545
  if(Array.isArray(objs)) {
3537
- var sortCount = objs.length;
3538
- for(var i = 0; i < sortCount; ++i) {
3539
- var obj = objs[i];
3540
- var field = obj["field"] || "";
3541
- var colIndex = obj["colIndex"];
3542
- var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
3543
-
3544
- var rowSorting = false;
3545
- var sortLogic = null;
3546
+ let sortCount = objs.length;
3547
+ for(let i = 0; i < sortCount; ++i) {
3548
+ let obj = objs[i];
3549
+ let field = obj["field"] || "";
3550
+ let colIndex = obj["colIndex"];
3551
+ let colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
3552
+
3553
+ let rowSorting = false;
3554
+ let sortLogic = null;
3546
3555
  if(colDef) {
3547
3556
  field = colDef.getField(); // WARNING: Field and logic could be out of sync
3548
3557
  rowSorting = colDef.isRowSorting();
@@ -3588,10 +3597,10 @@ Grid.prototype._clearDataUpdates = function() {
3588
3597
  if(!this._dt || !this._dt._hasNewUpdates) {
3589
3598
  return;
3590
3599
  }
3591
- var rowIds = this._dt.getAllRowIds(true); // Use shallow copy for speed
3592
- for(var i = rowIds.length; --i >= 0;) {
3593
- var rowData = this._dt.getRowData(rowIds[i]);
3594
- var rowDef = rowData[ROW_DEF];
3600
+ let rowIds = this._dt.getAllRowIds(true); // Use shallow copy for speed
3601
+ for(let i = rowIds.length; --i >= 0;) {
3602
+ let rowData = this._dt.getRowData(rowIds[i]);
3603
+ let rowDef = rowData[ROW_DEF];
3595
3604
  rowDef.resetUpdates();
3596
3605
  }
3597
3606
  };
@@ -3639,7 +3648,7 @@ Grid.prototype.getPageCount = function() {
3639
3648
  * @param {Grid~RowReference} rowRef
3640
3649
  */
3641
3650
  Grid.prototype.toggleChain = function(rowRef) {
3642
- var rowDef = this._getRowDefinitionByRef(rowRef);
3651
+ let rowDef = this._getRowDefinitionByRef(rowRef);
3643
3652
  if(rowDef) {
3644
3653
  rowDef.toggleChain();
3645
3654
  }
@@ -3651,7 +3660,7 @@ Grid.prototype.toggleChain = function(rowRef) {
3651
3660
  * @return {boolean}
3652
3661
  */
3653
3662
  Grid.prototype.setClassification = function(rowRef, fields) {
3654
- var rowDef = this._getRowDefinitionByRef(rowRef);
3663
+ let rowDef = this._getRowDefinitionByRef(rowRef);
3655
3664
  if(rowDef) {
3656
3665
  return this._dt.setSegmentClassification(rowDef.getRowId(), fields);
3657
3666
  }
@@ -3676,7 +3685,7 @@ Grid.prototype.contains = function(elem) {
3676
3685
  * @return {boolean}
3677
3686
  */
3678
3687
  Grid.prototype.isFocused = function() {
3679
- var activeElement = document.activeElement;
3688
+ let activeElement = document.activeElement;
3680
3689
  if(!activeElement || !activeElement.shadowRoot) {
3681
3690
  // active element is not in the shadow DOM. try using contains method to check
3682
3691
  return this.contains(activeElement);
@@ -3743,17 +3752,17 @@ Grid.prototype._onFormulaDataRequired = function(e) {
3743
3752
  * @param {Object} e
3744
3753
  */
3745
3754
  Grid.prototype._onDataComposed = function(e) {
3746
- var values = e["changes"];
3755
+ let values = e["changes"];
3747
3756
  if(!values) {
3748
3757
  return; // Cannot do data composition if there is no change in data
3749
3758
  }
3750
3759
 
3751
- var rowData = e["rowData"];
3760
+ let rowData = e["rowData"];
3752
3761
  if(!rowData) {
3753
3762
  return; // Row could already be removed or global change event is sent
3754
3763
  }
3755
3764
 
3756
- var rowDef = rowData[ROW_DEF];
3765
+ let rowDef = rowData[ROW_DEF];
3757
3766
  if(!rowDef) {
3758
3767
  return;
3759
3768
  }
@@ -3762,7 +3771,7 @@ Grid.prototype._onDataComposed = function(e) {
3762
3771
  }
3763
3772
 
3764
3773
  if(this._autoDateConversion) { // auto data conversion
3765
- var field, value, dataType, colDef;
3774
+ let field, value, dataType, colDef;
3766
3775
  for(field in values) {
3767
3776
  colDef = this._getColumnDefinition(field);
3768
3777
  if(colDef) {
@@ -3792,16 +3801,16 @@ Grid.prototype._onDataComposed = function(e) {
3792
3801
  * @param {Object} e
3793
3802
  */
3794
3803
  Grid.prototype._onSubSegmentChanged = function(e) {
3795
- var insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
3796
- var removalList = /** @type{Array.<string>} */(e["removalList"]);
3797
- var removedRows = /** @type{Object} */(e["removedRows"]);
3804
+ let insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
3805
+ let removalList = /** @type{Array.<string>} */(e["removalList"]);
3806
+ let removedRows = /** @type{Object} */(e["removedRows"]);
3798
3807
 
3799
- var i;
3800
- var removalCount = removalList.length;
3801
- var rowDef = null;
3808
+ let i;
3809
+ let removalCount = removalList.length;
3810
+ let rowDef = null;
3802
3811
  for(i = 0; i < removalCount; i++) {
3803
- var rid = removalList[i];
3804
- var removedRow = removedRows[rid];
3812
+ let rid = removalList[i];
3813
+ let removedRow = removedRows[rid];
3805
3814
  if(removedRow) {
3806
3815
  rowDef = removedRow[ROW_DEF];
3807
3816
  if(rowDef) {
@@ -3811,11 +3820,11 @@ Grid.prototype._onSubSegmentChanged = function(e) {
3811
3820
  }
3812
3821
  }
3813
3822
 
3814
- var insertionCount = insertionList.length;
3823
+ let insertionCount = insertionList.length;
3815
3824
  for(i = 0; i < insertionCount; i++) {
3816
- var segment = insertionList[i];
3817
- // var parentId = segment.getParentId();
3818
- var segmentId = segment.getId();
3825
+ let segment = insertionList[i];
3826
+ // let parentId = segment.getParentId();
3827
+ let segmentId = segment.getId();
3819
3828
  rowDef = new RowDefinition({
3820
3829
  "segmentId": segmentId
3821
3830
  });
@@ -3835,10 +3844,10 @@ Grid.prototype._recalculateFormulas = function(e) {
3835
3844
  if(e && e["rid"]) {
3836
3845
  this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
3837
3846
  } else {
3838
- var rows = this._dc ? this._dc.getAllRowData() : null; // Slow
3847
+ let rows = this._dc ? this._dc.getAllRowData() : null; // Slow
3839
3848
 
3840
- var rowCount = rows ? rows.length : 0;
3841
- for(var r = 0; r < rowCount; ++r) { // WARNING: This is very slow
3849
+ let rowCount = rows ? rows.length : 0;
3850
+ for(let r = 0; r < rowCount; ++r) { // WARNING: This is very slow
3842
3851
  this._fnEngine.calculate(rows[r]);
3843
3852
  }
3844
3853
  }
@@ -3850,11 +3859,11 @@ Grid.prototype._recalculateFormulas = function(e) {
3850
3859
  Grid.prototype._snapshotFillerDataChanged = function (e) {
3851
3860
  if (!this._dt) return;
3852
3861
 
3853
- var data = e.data;
3862
+ let data = e.data;
3854
3863
  if(e.timeSeries) {
3855
3864
  this._updateTimeSeriesFields(e); // Increase or decrease time series field
3856
3865
  } else {
3857
- for (var ric in data) {
3866
+ for (let ric in data) {
3858
3867
  this.setRicData(ric, data[ric]);
3859
3868
  }
3860
3869
  }
@@ -3869,7 +3878,7 @@ Grid.prototype._snapshotFillerDataChanged = function (e) {
3869
3878
  Grid.prototype._startPolling = function () {
3870
3879
  if(this._pollingEnabled && this._pollingInterval) {
3871
3880
  if(this._lastPollingRequest && !this._pollingTimerId) {
3872
- var now = new Date();
3881
+ let now = new Date();
3873
3882
  this._lastPollingRequest = now.getTime();
3874
3883
  this._pollingTimerId = setTimeout(this._onPollingInterval, this._pollingInterval);
3875
3884
  }
@@ -3891,9 +3900,9 @@ Grid.prototype.activateADCPolling = function (activated) {
3891
3900
  if(activated !== false) {
3892
3901
  this._pollingEnabled = true;
3893
3902
  // Make immediate request after re-activation if it has been a long time
3894
- var now = new Date();
3903
+ let now = new Date();
3895
3904
  if(this._lastPollingRequest) {
3896
- var diff = now.getTime() - this._lastPollingRequest;
3905
+ let diff = now.getTime() - this._lastPollingRequest;
3897
3906
  if(diff > this._pollingInterval) {
3898
3907
  this.refreshADCData();
3899
3908
  }
@@ -3908,7 +3917,7 @@ Grid.prototype.activateADCPolling = function (activated) {
3908
3917
  * @return {boolean} Return true, if a request has been made
3909
3918
  */
3910
3919
  Grid.prototype.refreshADCData = function () {
3911
- var dirty = this._snapshot.addFields(this._connector.getAllFields());
3920
+ let dirty = this._snapshot.addFields(this._connector.getAllFields());
3912
3921
  if(dirty) {
3913
3922
  dirty = this._snapshot.addRics(this._connector.getAllRics());
3914
3923
  if(dirty) {
@@ -3922,9 +3931,9 @@ Grid.prototype.refreshADCData = function () {
3922
3931
  /** @private
3923
3932
  */
3924
3933
  Grid.prototype._onAutoLayoutUpdate = function() {
3925
- var elem = this._topNode;
3934
+ let elem = this._topNode;
3926
3935
 
3927
- var cw = elem.clientWidth;
3936
+ let cw = elem.clientWidth;
3928
3937
  if(cw !== this._clientWidth) {
3929
3938
  this._clientWidth = cw;
3930
3939
  this.updateLayout();
@@ -3936,7 +3945,7 @@ Grid.prototype._onAutoLayoutUpdate = function() {
3936
3945
  * @param {Object=} opt_options { "colNames": Array.<string>, "rowCount": number, "startIndex": number, "getter": function(Object, string):* }
3937
3946
  */
3938
3947
  Grid.prototype.logDT = function(opt_options) {
3939
- var rowDefs = this._getAllRowDefinitions();
3948
+ let rowDefs = this._getAllRowDefinitions();
3940
3949
  this._logData(rowDefs, opt_options);
3941
3950
  };
3942
3951
  /** @description Log DataView to console. By default, this will log only fields specified in the column definition. To see other column data use "colNames" options
@@ -3954,7 +3963,7 @@ Grid.prototype.logDT = function(opt_options) {
3954
3963
  grid.logDV({"rowCount": 10}); // Showing 10 records
3955
3964
  */
3956
3965
  Grid.prototype.logDV = function(opt_options) {
3957
- var rowDefs = this.getRowDefinitions();
3966
+ let rowDefs = this.getRowDefinitions();
3958
3967
  this._logData(rowDefs, opt_options);
3959
3968
  };
3960
3969
  /** Log the collection of data to console
@@ -3970,7 +3979,7 @@ Grid.prototype._logData = function(rowDefs, options) {
3970
3979
  // TODO: Get all required fields and eliminate duplicate fields
3971
3980
  options["colNames"] = this.getColumnFields();
3972
3981
  }
3973
- var tbl = DataCache.constructTable(rowDefs.map(toRowData), options);
3982
+ let tbl = DataCache.constructTable(rowDefs.map(toRowData), options);
3974
3983
 
3975
3984
  console.table(tbl); // eslint-disable-line
3976
3985
  };
@@ -3982,17 +3991,17 @@ Grid.prototype._logData = function(rowDefs, options) {
3982
3991
  * @returns {RowDefinition}
3983
3992
  */
3984
3993
  Grid.prototype.replaceRow = function(rowRef, rowOption) {
3985
- var rowId = this._getRowId(rowRef);
3986
- var rowDef = this._getRowDefinitionByRef(rowRef);
3994
+ let rowId = this._getRowId(rowRef);
3995
+ let rowDef = this._getRowDefinitionByRef(rowRef);
3987
3996
  if(rowDef.isAutoGenerated()) { // Users cannot replace auto-generated
3988
3997
  return null;
3989
3998
  }
3990
- var configObj = rowDef.getConfigObject();
3999
+ let configObj = rowDef.getConfigObject();
3991
4000
 
3992
4001
  if(deepEqual(configObj, rowOption)){
3993
4002
  return null;
3994
4003
  } else {
3995
- var insertedRow = this.insertRow(rowOption, rowId);
4004
+ let insertedRow = this.insertRow(rowOption, rowId);
3996
4005
  this.removeRow(rowId);
3997
4006
  return insertedRow;
3998
4007
  }