@refinitiv-ui/efx-grid 6.0.139 → 6.0.141

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/lib/core/dist/core.js +99 -28
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataTable.d.ts +5 -1
  4. package/lib/core/es6/data/DataTable.js +38 -8
  5. package/lib/core/es6/data/DataView.d.ts +2 -0
  6. package/lib/core/es6/data/DataView.js +8 -0
  7. package/lib/core/es6/data/Segment.d.ts +1 -1
  8. package/lib/core/es6/data/Segment.js +16 -4
  9. package/lib/core/es6/data/SegmentCollection.d.ts +2 -0
  10. package/lib/core/es6/data/SegmentCollection.js +21 -10
  11. package/lib/core/es6/grid/Core.js +1 -1
  12. package/lib/core/es6/grid/components/Cell.js +9 -3
  13. package/lib/core/es6/grid/components/ElementWrapper.d.ts +2 -0
  14. package/lib/core/es6/grid/components/ElementWrapper.js +6 -2
  15. package/lib/grid/index.js +1 -1
  16. package/lib/row-segmenting/es6/RowSegmenting.d.ts +8 -1
  17. package/lib/row-segmenting/es6/RowSegmenting.js +88 -23
  18. package/lib/rt-grid/dist/rt-grid.js +607 -566
  19. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  20. package/lib/rt-grid/es6/Grid.js +37 -14
  21. package/lib/rt-grid/es6/RowDefinition.d.ts +1 -1
  22. package/lib/rt-grid/es6/RowDefinition.js +11 -3
  23. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +1 -1
  24. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +2 -3
  25. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +2 -0
  26. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +38 -8
  27. package/lib/types/es6/ConditionalColoring.d.ts +1 -1
  28. package/lib/types/es6/Core/data/DataTable.d.ts +5 -1
  29. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  30. package/lib/types/es6/Core/data/Segment.d.ts +1 -1
  31. package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
  32. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +2 -0
  33. package/lib/types/es6/RowFiltering.d.ts +2 -1
  34. package/lib/versions.json +3 -3
  35. package/package.json +1 -1
@@ -88,6 +88,8 @@ declare class DataTable extends DataCache {
88
88
 
89
89
  public hasSegmentation(): boolean;
90
90
 
91
+ public hasSegmentClassification(): boolean;
92
+
91
93
  public isSegmentSeparator(rid: string): boolean;
92
94
 
93
95
  public getSegment(rid: string): Segment|null;
@@ -132,6 +134,8 @@ declare class DataTable extends DataCache {
132
134
 
133
135
  public requestClassifying(): void;
134
136
 
137
+ public setSegmentDefaultCollapsing(bool: boolean): boolean;
138
+
135
139
  public dispatchGlobalChange(suppressEvent?: boolean|null): void;
136
140
 
137
141
  public static getSortingDefinitions(): void;
@@ -144,7 +148,7 @@ declare function prevFrozen(ary: (any)[][], opt_cidList?: (string)[]|null, opt_r
144
148
 
145
149
  declare function cid(): null;
146
150
 
147
- declare function removalList(sortingDefs: (any[])[]|null): boolean;
151
+ declare function removalList(bool: boolean): boolean;
148
152
 
149
153
  declare function logic(a: number, b: number, order: number, sortingDefs: (any[])[]|null): number;
150
154
 
@@ -91,6 +91,10 @@ DataTable.prototype._clsSource = null;
91
91
  * @type {number}
92
92
  */
93
93
  DataTable.prototype._classifyingTimer = 0;
94
+ /** @private
95
+ * @type {boolean}
96
+ */
97
+ DataTable.prototype._segmentDefaultCollapsing = false;
94
98
 
95
99
 
96
100
  /** @typedef {Function} DataTable~SortLogic
@@ -1003,6 +1007,15 @@ DataTable.prototype.isFrozen = function() {
1003
1007
  return this._frozen;
1004
1008
  };
1005
1009
 
1010
+ /** @private
1011
+ */
1012
+ DataTable.prototype._initSegmentCollection = function() {
1013
+ if (!this._segments) {
1014
+ this._segments = new SegmentCollection();
1015
+ this._segments.setDefaultCollapsing(this._segmentDefaultCollapsing);
1016
+ this._segments.addEventListener("subSegmentChanged", this._onSubSegmentChanged);
1017
+ }
1018
+ };
1006
1019
  /**
1007
1020
  * @public
1008
1021
  * @param {Array.<string>} rids
@@ -1017,10 +1030,7 @@ DataTable.prototype.setSegmentSeparators = function(rids, enabled) {
1017
1030
  for (let i = 0; i < len; i++) {
1018
1031
  if(enabled !== false) {
1019
1032
  let rid = rids[i];
1020
- if (!this._segments) {
1021
- this._segments = new SegmentCollection();
1022
- this._segments.addEventListener("subSegmentChanged", this._onSubSegmentChanged);
1023
- }
1033
+ this._initSegmentCollection();
1024
1034
  if(this._autoSegmentFilling) {
1025
1035
  let parentId = this._segments.getParentRowId(rid);
1026
1036
  if(parentId) {
@@ -1064,10 +1074,7 @@ DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
1064
1074
  let memberCount = 0;
1065
1075
  if(rid && typeof rid === "string") {
1066
1076
  if(enabled !== false) {
1067
- if(!this._segments) {
1068
- this._segments = new SegmentCollection();
1069
- this._segments.addEventListener("subSegmentChanged", this._onSubSegmentChanged);
1070
- }
1077
+ this._initSegmentCollection();
1071
1078
  if(this._autoSegmentFilling) {
1072
1079
  let parentId = this._segments.getParentRowId(rid);
1073
1080
  if(parentId) {
@@ -1131,6 +1138,13 @@ DataTable.prototype.hasSegmentation = function() {
1131
1138
  };
1132
1139
  /**
1133
1140
  * @public
1141
+ * @return {boolean}
1142
+ */
1143
+ DataTable.prototype.hasSegmentClassification = function() {
1144
+ return this._segments ? this._segments.hasClassification() : false;
1145
+ };
1146
+ /**
1147
+ * @public
1134
1148
  * @param {string} rid
1135
1149
  * @return {boolean}
1136
1150
  */
@@ -1627,6 +1641,22 @@ DataTable.prototype._onSubSegmentChanged = function(e) {
1627
1641
  }
1628
1642
  };
1629
1643
 
1644
+ /**
1645
+ * @public
1646
+ * @param {boolean} bool
1647
+ * @return {boolean}
1648
+ */
1649
+ DataTable.prototype.setSegmentDefaultCollapsing = function(bool) {
1650
+ if(this._segmentDefaultCollapsing !== bool) {
1651
+ this._segmentDefaultCollapsing = bool;
1652
+ if(this._segments) {
1653
+ this._segments.setDefaultCollapsing(bool);
1654
+ }
1655
+ return true;
1656
+ }
1657
+ return false;
1658
+ };
1659
+
1630
1660
 
1631
1661
  /**
1632
1662
  * @public
@@ -304,6 +304,8 @@ declare class DataView extends EventDispatcher {
304
304
 
305
305
  public setSegmentClassification(segmentRef: string|number|null, fields: string|(string)[]|null): boolean;
306
306
 
307
+ public setSegmentDefaultCollapsing(bool: boolean): boolean;
308
+
307
309
  public getWrapSize(): number;
308
310
 
309
311
  public getWrappedViews(): (WrappedView)[]|null;
@@ -2746,6 +2746,14 @@ DataView.prototype.enableSeparatorFiltering = function (enabled) {
2746
2746
  DataView.prototype.setSegmentClassification = function(segmentRef, fields) {
2747
2747
  return this._dt.setSegmentClassification(this._toRowId(segmentRef), fields);
2748
2748
  };
2749
+ /**
2750
+ * @public
2751
+ * @param {boolean} bool
2752
+ * @return {boolean}
2753
+ */
2754
+ DataView.prototype.setSegmentDefaultCollapsing = function(bool) {
2755
+ return this._dt.setSegmentDefaultCollapsing(bool);
2756
+ };
2749
2757
 
2750
2758
  /** @public
2751
2759
  * @ignore
@@ -65,7 +65,7 @@ declare class Segment extends EventDispatcher {
65
65
 
66
66
  public setOrder(val: number): void;
67
67
 
68
- public log(lines: (string)[]|null): (string)[]|null;
68
+ public log(lines?: (string)[]|null): (string)[];
69
69
 
70
70
  }
71
71
 
@@ -10,6 +10,9 @@ let Segment = function(rid, sharedObj) {
10
10
  this._rid = rid;
11
11
  this._children = {};
12
12
  this._shared = sharedObj;
13
+ if(sharedObj.defaultCollapsing) {
14
+ this._collapsed = true;
15
+ }
13
16
  };
14
17
  Ext.inherits(Segment, EventDispatcher);
15
18
 
@@ -124,9 +127,12 @@ Segment.prototype.dispose = function() {
124
127
  this._subSegMap = this._subSegNames = null;
125
128
  }
126
129
  if(this._collapsed) {
127
- this._shared.dirtyCollapsingState = true;
130
+ if(this._childCount || this._subSegDef) {
131
+ this._shared.dirtyCollapsingState = true;
132
+ }
128
133
  }
129
134
 
135
+ this._childCount = 0;
130
136
  this._shared = null;
131
137
  this._subSegParent = this._subSegDef = this._subSegVal = null;
132
138
  };
@@ -627,7 +633,9 @@ Segment.prototype.collapse = function(bool) {
627
633
  bool = (bool !== false);
628
634
  if(this._collapsed !== bool) {
629
635
  this._collapsed = bool;
630
- this._shared.dirtyCollapsingState = true;
636
+ if(this._childCount || this._subSegDef) {
637
+ this._shared.dirtyCollapsingState = true;
638
+ }
631
639
  return true;
632
640
  }
633
641
  return false;
@@ -734,10 +742,14 @@ Segment.prototype.setOrder = function(val) {
734
742
  */
735
743
  Segment._tabs = null;
736
744
  /** @public
737
- * @param {Array.<string>} lines
738
- * @return {Array.<string>} lines
745
+ * @param {Array.<string>=} lines
746
+ * @return {!Array.<string>} lines
739
747
  */
740
748
  Segment.prototype.log = function(lines) {
749
+ if(!lines) {
750
+ lines = [];
751
+ }
752
+
741
753
  let i;
742
754
  let tabs = Segment._tabs;
743
755
  if(!tabs) {
@@ -70,6 +70,8 @@ declare class SegmentCollection extends EventDispatcher {
70
70
 
71
71
  public classify(rows: { [key: string]: any }|null): boolean;
72
72
 
73
+ public setDefaultCollapsing(bool: boolean): boolean;
74
+
73
75
  }
74
76
 
75
77
  export default SegmentCollection;
@@ -15,7 +15,8 @@ let SegmentCollection = function() {
15
15
 
16
16
  this._shared = {
17
17
  childToSegment: {}, // child Id to segment Id
18
- dirtyCollapsingState: false
18
+ dirtyCollapsingState: false,
19
+ defaultCollapsing: false
19
20
  };
20
21
  };
21
22
  Ext.inherits(SegmentCollection, EventDispatcher);
@@ -214,19 +215,17 @@ SegmentCollection.prototype.getSegmentIds = function() {
214
215
  * @return {boolean} Returns true if there is any change. Otherwise, returns false
215
216
  */
216
217
  SegmentCollection.prototype.collapseSegments = function(segmentIds, bool) {
218
+ let dirty = 0;
217
219
  if(this._segmentCount) {
218
- let dirty = 0;
219
220
  let len = segmentIds.length;
220
221
  for (let i = 0; i < len; i++) {
221
- let rowId = segmentIds[i];
222
- dirty |= this._segments[rowId].collapse(bool);
223
-
224
- }
225
- if(dirty) {
226
- return true;
222
+ let segment = this._segments[segmentIds[i]];
223
+ if(segment) {
224
+ dirty |= segment.collapse(bool);
225
+ }
227
226
  }
228
227
  }
229
- return false;
228
+ return dirty ? true : false;
230
229
  };
231
230
 
232
231
  /** @public
@@ -547,7 +546,6 @@ SegmentCollection.prototype.logRowIdMap = function() {
547
546
  return lines.join("\n");
548
547
  };
549
548
 
550
-
551
549
  /** @public
552
550
  * @param {string} segmentId
553
551
  * @param {string|Array.<string>} fields
@@ -638,6 +636,19 @@ SegmentCollection.prototype._onSubSegmentRemoved = function(e) {
638
636
  this.removeSegment(rid);
639
637
  };
640
638
 
639
+ /** @public
640
+ * @param {boolean} bool
641
+ * @return {boolean}
642
+ */
643
+ SegmentCollection.prototype.setDefaultCollapsing = function(bool) {
644
+ let newVal = bool ? true : false;
645
+ if(this._shared.defaultCollapsing !== newVal) {
646
+ this._shared.defaultCollapsing = newVal;
647
+ return true;
648
+ }
649
+ return false;
650
+ };
651
+
641
652
 
642
653
  export default SegmentCollection;
643
654
  export { SegmentCollection };
@@ -621,7 +621,7 @@ Core.prototype._hasPendingRowChange = false;
621
621
  * @return {string}
622
622
  */
623
623
  Core.getVersion = function () {
624
- return "5.1.133";
624
+ return "5.1.135";
625
625
  };
626
626
  /** {@link ElementWrapper#dispose}
627
627
  * @override
@@ -739,11 +739,17 @@ Cell.prototype.updateTooltip = function() {
739
739
  }
740
740
 
741
741
  if(customizedTooltip) {
742
- if(this.getAttribute("title") !== customizedTooltip) {
742
+ let curTooltip = this.hasAttribute("tooltip") ? this.getAttribute("tooltip") : this.getAttribute("title");
743
+ if(curTooltip !== customizedTooltip) {
743
744
  this.setAttribute("title", customizedTooltip);
744
745
  }
745
- } else if(this.getAttribute("title") != null) {
746
- this.removeAttribute("title");
746
+ } else {
747
+ if(this.hasAttribute("title")) {
748
+ this.removeAttribute("title");
749
+ }
750
+ if(this.hasAttribute("tooltip")) {
751
+ this.removeAttribute("tooltip");
752
+ }
747
753
  }
748
754
  };
749
755
  /** @public
@@ -51,6 +51,8 @@ declare class ElementWrapper extends EventDispatcher {
51
51
 
52
52
  public getAttribute(str: string): string;
53
53
 
54
+ public hasAttribute(str: string): boolean;
55
+
54
56
  public setAttribute(str: string, val: string): void;
55
57
 
56
58
  public setAttributes(json: any): void;
@@ -436,12 +436,16 @@ ElementWrapper.prototype.getClass = function () { return this._element.className
436
436
  */
437
437
  ElementWrapper.prototype.setClass = function (str) { this._element.className = str; };
438
438
 
439
- /**
440
- * @public
439
+ /** @public
441
440
  * @param {string} str
442
441
  * @return {string}
443
442
  */
444
443
  ElementWrapper.prototype.getAttribute = function (str) { return this._element.getAttribute(str); };
444
+ /** @public
445
+ * @param {string} str
446
+ * @return {boolean}
447
+ */
448
+ ElementWrapper.prototype.hasAttribute = function (str) { return this._element.hasAttribute(str); };
445
449
  /** Sets attribute to DOM element
446
450
  * @public
447
451
  * @param {string} str
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.139" };
3
+ window.EFX_GRID = { version: "6.0.141" };
@@ -22,9 +22,16 @@ declare namespace RowSegmentingPlugin {
22
22
  sortingLogic?: ((...params: any[]) => any)|null,
23
23
  rowSpanningField?: string|null,
24
24
  segmentIdField?: string|null,
25
+ collapsingField?: string|null,
26
+ defaultCollapsing?: boolean|null,
25
27
  displayColumn?: (string|number)|null
26
28
  };
27
29
 
30
+ type SegmentDefinition = {
31
+ children?: (string)[]|null,
32
+ collapsed?: boolean|null
33
+ };
34
+
28
35
  }
29
36
 
30
37
  declare class RowSegmentingPlugin extends GridPlugin {
@@ -51,7 +58,7 @@ declare class RowSegmentingPlugin extends GridPlugin {
51
58
 
52
59
  public setSegmentSeparators(rowIds: (string)[]|null, enabled?: boolean|null): boolean;
53
60
 
54
- public setSegmentSeparator(rowRef: string|number|null, enabled?: boolean|null): boolean;
61
+ public setSegmentSeparator(rowRef: string|number|null, options?: any): boolean;
55
62
 
56
63
  public setSegmentClassification(rowRef: string|number|null, fields: string|(string)[]|null): boolean;
57
64
 
@@ -18,8 +18,10 @@ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
18
18
  * @property {Function=} nonSegmentSeparatorBinding=null Logic that will be executed for all non segment separator row
19
19
  * @property {Function=} sortingLogic=null Logic to be used by sortSegments method
20
20
  * @property {string=} rowSpanningField="ROW_SPANNING" Field to be used for spanning segment header rows based on the field values
21
- * @property {string=} segmentIdField="" Field to be used for initializing segments based on text id
22
- * @property {(string|number)=} displayColumn=null Render tags in the given column. It can be either the column index, column ID, or field.
21
+ * @property {string=} segmentIdField="" Field used for initializing segments based on text id
22
+ * @property {string=} collapsingField="" Field used for indicating that the corresponding segment row is collapsed
23
+ * @property {boolean=} defaultCollapsing=false If enabled, any newly created segment will be collapsed by default
24
+ * @property {(string|number)=} displayColumn=null Render tags in the given column. It can be either the column index, column ID, or field
23
25
  */
24
26
 
25
27
  /** @callback RowSegmentingPlugin~SortingLogic
@@ -29,6 +31,12 @@ import { Conflator } from "../../tr-grid-util/es6/Conflator.js";
29
31
  * @return {number}
30
32
  */
31
33
 
34
+ /** @typedef {Object} RowSegmentingPlugin~SegmentDefinition
35
+ * @description An object that can be passed to setSegmentSeparator method
36
+ * @property {Array.<string>=} children=null Array of child row ids
37
+ * @property {boolean=} collapsed Initial expanding/colapssing state of the segment
38
+ */
39
+
32
40
  /** @constructor
33
41
  * @param {RowSegmentingPlugin~Options=} options
34
42
  * @extends {GridPlugin}
@@ -93,6 +101,10 @@ RowSegmentingPlugin.prototype._rowSpanningField = "ROW_SPANNING";
93
101
  * @private
94
102
  */
95
103
  RowSegmentingPlugin.prototype._segmentIdField = "";
104
+ /** @type {string}
105
+ * @private
106
+ */
107
+ RowSegmentingPlugin.prototype._collapsingField = "";
96
108
  /** @type {number}
97
109
  * @private
98
110
  */
@@ -117,6 +129,10 @@ RowSegmentingPlugin._controlClass = "predefined-color-tag";
117
129
  * @private
118
130
  */
119
131
  RowSegmentingPlugin.prototype._collapsingMap = null;
132
+ /** @type {boolean}
133
+ * @private
134
+ */
135
+ RowSegmentingPlugin.prototype._defaultCollapsing = false;
120
136
 
121
137
  /** @public
122
138
  * @return {string}
@@ -154,6 +170,10 @@ RowSegmentingPlugin.prototype.initialize = function (host, options) {
154
170
  host.listen("preSectionDataBinding", this._onPreSectionDataBinding);
155
171
 
156
172
  this.config(options);
173
+ let dv = host.getDataSource();
174
+ if(dv && dv.setSegmentDefaultCollapsing) {
175
+ dv.setSegmentDefaultCollapsing(this._defaultCollapsing);
176
+ }
157
177
 
158
178
  let enabled = this._colorTag != null ? this._colorTag : ElfUtil.isHaloTheme();
159
179
  RowPainter.disableColorTag(host, enabled === false);
@@ -216,10 +236,11 @@ RowSegmentingPlugin.prototype.requestSeparatorRefresh = function () {
216
236
 
217
237
  let rowIds = dt.getAllRowIds();
218
238
  let rowCount = rowIds.length;
219
- let separatorMap = {};
239
+ let segmentMap = {};
220
240
  let segmentArr = [];
221
241
  let separatorArr = [];
222
- let collapseArr = [];
242
+ let collapsingAry = [];
243
+ let expandingAry = [];
223
244
  for(let i = 0; i < rowCount; i++) {
224
245
  rowId = rowIds[i];
225
246
  rowData = this._rowGetter(dt.getRowData(rowId));
@@ -227,25 +248,39 @@ RowSegmentingPlugin.prototype.requestSeparatorRefresh = function () {
227
248
  if(segmentId == null) {
228
249
  continue;
229
250
  }
230
- if(separatorMap[segmentId] == null) {
231
- separatorMap[segmentId] = {
251
+ let segmentInfo = segmentMap[segmentId];
252
+ if(segmentInfo) {
253
+ segmentInfo.rowIds.push(rowId);
254
+ } else {
255
+ segmentInfo = segmentMap[segmentId] = {
232
256
  rowIds: [],
233
- segmentId: rowId // Row id of parent
257
+ segmentId: rowId
234
258
  };
235
- segmentArr.push(separatorMap[segmentId]);
259
+ segmentArr.push(segmentInfo);
236
260
  separatorArr.push(rowId);
237
- if (collapsingMap[segmentId] === true) { // TODO: Currenly is expand by default, then it need to only collapse some row from prev segment id
238
- collapseArr.push(rowId);
261
+
262
+ let collapsed = (this._collapsingField) ? rowData[this._collapsingField] : collapsingMap[segmentId];
263
+ if(collapsed != null) {
264
+ if(collapsed) {
265
+ collapsingAry.push(rowId);
266
+ } else {
267
+ expandingAry.push(rowId);
268
+ }
239
269
  }
240
- } else {
241
- // Add rowId to set segment separator
242
- separatorMap[segmentId].rowIds.push(rowId);
243
270
  }
244
271
  this._prevSegmentBySegmentId = true;
245
272
  }
246
- this.setSegmentSeparators(separatorArr);
247
- this.setSegmentChildren(segmentArr);
248
- this.collapseSegments(collapseArr);
273
+ if(segmentArr.length) {
274
+ this.setSegmentSeparators(separatorArr); // TODO: This method can be merged into setSegmentChildren
275
+ this.setSegmentChildren(segmentArr);
276
+ }
277
+
278
+ if(collapsingAry.length) {
279
+ this.collapseSegments(collapsingAry, true);
280
+ }
281
+ if(expandingAry.length) {
282
+ this.collapseSegments(expandingAry, false);
283
+ }
249
284
  };
250
285
  /** @public
251
286
  * @param {Object=} host core grid instance
@@ -297,12 +332,21 @@ RowSegmentingPlugin.prototype.config = function (options) {
297
332
  if (option.segmentIdField != null) {
298
333
  this._segmentIdField = option.segmentIdField;
299
334
  }
335
+ if (option.collapsingField != null) {
336
+ this._collapsingField = option.collapsingField;
337
+ }
300
338
  if (option.predefinedColors != null && typeof option.predefinedColors === "object") {
301
339
  this._predefinedColors = option.predefinedColors;
302
340
  }
303
341
  if(option.displayColumn != null) {
304
342
  this._displayColumn = option.displayColumn;
305
343
  }
344
+ if(option.defaultCollapse != null) {
345
+ this._defaultCollapsing = option.defaultCollapse;
346
+ }
347
+ if(option.defaultCollapsing != null) {
348
+ this._defaultCollapsing = option.defaultCollapsing;
349
+ }
306
350
 
307
351
  this._rowPainter = new RowPainter({
308
352
  clickableCell: false,
@@ -371,6 +415,12 @@ RowSegmentingPlugin.prototype.getConfigObject = function (gridOptions) {
371
415
  if(this._segmentIdField) {
372
416
  extOptions.segmentIdField = this._segmentIdField;
373
417
  }
418
+ if(this._collapsingField) {
419
+ extOptions.collapsingField = this._collapsingField;
420
+ }
421
+ if(this._defaultCollapsing) {
422
+ extOptions.defaultCollapsing = true;
423
+ }
374
424
 
375
425
  if(this._displayColumn != null) {
376
426
  // WANRING: display column use colId and colIndex for internal, but give field and colIndex for user
@@ -415,14 +465,18 @@ RowSegmentingPlugin.prototype.getRowConfigObject = function (rowData, rowId) {
415
465
  }
416
466
 
417
467
  if(this.isSegmentSeparator(rowId)) {
418
- if(obj["collapsed"] == null) { // Avoid overriding value from real-time grid
419
- obj["collapsed"] = this.isSegmentCollapsed(rowId);
420
- }
421
-
422
468
  if(!obj.values) {
423
469
  obj.values = {};
424
470
  }
425
471
  obj.values[this._segmentIdField] = ++this._runningId;
472
+
473
+ let collapsed = this.isSegmentCollapsed(rowId);
474
+ if(this._collapsingField) {
475
+ obj.values[this._collapsingField] = collapsed;
476
+ }
477
+ if(obj["collapsed"] == null) { // Avoid overriding value from real-time grid
478
+ obj["collapsed"] = collapsed;
479
+ }
426
480
  } else {
427
481
  let parentId = this.getSegmentParentRowId(rowId);
428
482
  if(parentId) {
@@ -750,13 +804,24 @@ RowSegmentingPlugin.prototype.setSegmentSeparators = function(rowIds, enabled) {
750
804
  /** Set specified row as a segment separator
751
805
  * @public
752
806
  * @param {string|number} rowRef Row id or row index
753
- * @param {boolean=} enabled
807
+ * @param {*=} options The segment will be created and initialized according to the given option. If the value is false, the specified segment is removed.
754
808
  * @return {boolean} Return true if there is any change
755
809
  */
756
- RowSegmentingPlugin.prototype.setSegmentSeparator = function(rowRef, enabled) {
810
+ RowSegmentingPlugin.prototype.setSegmentSeparator = function(rowRef, options) {
757
811
  let dv = this._getDataView();
758
812
  if(dv) {
759
- return dv.setSegmentSeparator(rowRef, enabled);
813
+ if(options) {
814
+ dv.setSegmentSeparator(rowRef, true);
815
+
816
+ if(Array.isArray(options.children)) {
817
+ dv.addSegmentChildren(rowRef, options.children);
818
+ }
819
+ if(options.collapsed != null) {
820
+ dv.collapseSegment(rowRef, options.collapsed);
821
+ }
822
+ } else {
823
+ return dv.setSegmentSeparator(rowRef, options == null);
824
+ }
760
825
  }
761
826
  return false;
762
827
  };