@refinitiv-ui/efx-grid 6.0.95 → 6.0.97

Sign up to get free protection for your applications and to get access to all the features.
@@ -367,14 +367,20 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
367
367
  let segmentId = "";
368
368
  if(this._view) {
369
369
  segmentId = this._view.getSegmentParentRowId(this._rowId);
370
- if(this._isChain && segmentId){ // If the row was a normal row and has been changed to a chain, remove it from existing segment
371
- let targetRowId = _getEndOfSegmentRowId(this._view, this._rowId);
372
- this._view.removeSegmentChild(segmentId, this._rowId);
373
- this._view.moveRow(this._rowId, targetRowId);
370
+ if(segmentId) {
371
+ if(this._isChain){ // If the row was a normal row and has been changed to a chain, remove it from existing segment
372
+ let targetRowId = _getEndOfSegmentRowId(this._view, this._rowId);
373
+ this._view.removeSegmentChild(segmentId, this._rowId);
374
+ this._view.moveRow(this._rowId, targetRowId);
374
375
 
375
- segmentId = "";
376
+ segmentId = "";
377
+ }
378
+ } else if(this._view.getSegment(this._rowId)) {
379
+ this._view.setSegmentSeparator(this._rowId, false); // Remove existing segment
380
+ }
381
+ if(this._isChain) {
382
+ this._view.setSegmentSeparator(this._rowId, true);
376
383
  }
377
- this._view.setSegmentSeparator(this._rowId, !!this._isChain);
378
384
  if(this.isChainCollapsed()) {
379
385
  if(this._expanded){
380
386
  this.expandChain();
@@ -956,7 +962,7 @@ RowDefinition.prototype.registerToView = function(view, rowId) {
956
962
  if(!this._expanded) {
957
963
  this.collapseChain();
958
964
  }
959
- } else if(parentRowId) {
965
+ } else if(!this._parent && parentRowId) { // Constituent cannot be added to another segment
960
966
  view.addSegmentChild(parentRowId, this._rowId, this._dataId);
961
967
  }
962
968
  };
@@ -1049,13 +1055,15 @@ RowDefinition.prototype.addConstituent = function(ric) {
1049
1055
  let rowId = this.getRowId();
1050
1056
  // WARNING: insert position, we prioritize using CHILD_ORDER (From server) in dc first. If it does not exist, the last row of the segment will be pushed
1051
1057
  let childOrder = childDef.getData("CHILD_ORDER");
1052
- let parentIndex = this._view.getRowIndex(rowId);
1058
+ let dt = this._view.getDataSource();
1059
+
1060
+ let parentIndex = dt.getRowIndex(rowId);
1053
1061
  let position = parentIndex + this.getChildCount(); // push the last position
1054
1062
  if(childOrder != null) {
1055
1063
  // Warning: We need to carry a value of 1 because the CHILD_ORDER starts with 0, and it will be added to the parentIndex. In case the parent rowIndex is not included.
1056
1064
  position = parentIndex + childOrder + 1; // insert between segment
1057
1065
  } // else {} it will be push in the last row of segment
1058
- childDef.registerToView(this._view, this._view.getRowId(position));
1066
+ childDef.registerToView(this._view, dt.getRowId(position));
1059
1067
  // TODO: Handle nested children
1060
1068
  this._view.addSegmentChild(rowId, childDef.getRowId(), childDef.getDataId());
1061
1069
  }