@syncfusion/ej2-treegrid 21.2.6 → 21.2.8

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.
@@ -2190,7 +2190,18 @@ class DataManipulation {
2190
2190
  }
2191
2191
  result = resultChildData;
2192
2192
  }
2193
- rowDetails.record.childRecords = result;
2193
+ if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2194
+ rowDetails.record.childRecords = [];
2195
+ for (let i = 0; i < result.length; i++) {
2196
+ if (rowDetails.record['' + this.parent.idMapping] !== result[parseInt(i.toString(), 10)]['' + this.parent.idMapping] &&
2197
+ rowDetails.record['' + this.parent.idMapping] === result[parseInt(i.toString(), 10)]['' + this.parent.parentIdMapping] && Object.prototype.hasOwnProperty.call(result, i)) {
2198
+ rowDetails.record.childRecords.push(result[parseInt(i.toString(), 10)]);
2199
+ }
2200
+ }
2201
+ }
2202
+ else {
2203
+ rowDetails.record.childRecords = result;
2204
+ }
2194
2205
  for (let r = 0; r < result.length; r++) {
2195
2206
  if (this.parent.enableVirtualization && result[parseInt(r.toString(), 10)][`${this.parent.idMapping}`] === rowDetails.record[`${this.parent.idMapping}`] && rowDetails.action === 'remoteExpand') {
2196
2207
  this.parent[`${remoteExpandedData}`].push(rowDetails.record);
@@ -2208,6 +2219,7 @@ class DataManipulation {
2208
2219
  if (result[parseInt(r.toString(), 10)][`${this.parent.parentIdMapping}`] === this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)][`${this.parent.idMapping}`]) {
2209
2220
  result[parseInt(r.toString(), 10)].level = this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)][`${level}`] + 1;
2210
2221
  const parentData = this.parent[`${remoteExpandedData}`][parseInt(i.toString(), 10)];
2222
+ delete parentData.childRecords;
2211
2223
  result[parseInt(r.toString(), 10)].parentItem = parentData;
2212
2224
  result[parseInt(r.toString(), 10)].parentUniqueID = rowDetails.record.uniqueID;
2213
2225
  }
@@ -2219,6 +2231,10 @@ class DataManipulation {
2219
2231
  && !(haveChild && !haveChild[parseInt(r.toString(), 10)])) {
2220
2232
  if (isNullOrUndefined(result[parseInt(r.toString(), 10)][`${this.parent.parentIdMapping}`])) {
2221
2233
  result[parseInt(r.toString(), 10)].level = 0;
2234
+ if (rowDetails.action === 'remoteExpand') {
2235
+ result[parseInt(r.toString(), 10)].childRecords = [];
2236
+ result[parseInt(r.toString(), 10)].childRecords = rowDetails.record.childRecords;
2237
+ }
2222
2238
  }
2223
2239
  else {
2224
2240
  result[parseInt(r.toString(), 10)].level = rowDetails.record.level;
@@ -5890,7 +5906,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5890
5906
  record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
5891
5907
  }
5892
5908
  else {
5893
- record = this.grid.getCurrentViewRecords()[parseInt(row.getAttribute('data-rowindex'), 10)];
5909
+ if (this.enableVirtualization && this.isCollapseAll) {
5910
+ record = this.grid.getCurrentViewRecords()[row.rowIndex];
5911
+ }
5912
+ else {
5913
+ record = this.grid.getCurrentViewRecords()[parseInt(row.getAttribute('data-rowindex'), 10)];
5914
+ }
5894
5915
  }
5895
5916
  }
5896
5917
  return record;
@@ -6113,7 +6134,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6113
6134
  if (rows.length) {
6114
6135
  for (let i = 0; i < rows.length; i++) {
6115
6136
  if (action === 'collapse') {
6116
- this.collapseRow(rows[parseInt(i.toString(), 10)]);
6137
+ if (!isNullOrUndefined(this.getCurrentViewRecords()[rows[parseInt(i.toString(), 10)].rowIndex])) {
6138
+ this.collapseRow(rows[parseInt(i.toString(), 10)]);
6139
+ }
6117
6140
  }
6118
6141
  else {
6119
6142
  this.expandRow(rows[parseInt(i.toString(), 10)]);
@@ -11695,7 +11718,7 @@ class Edit$1 {
11695
11718
  index = index + batchChildCount;
11696
11719
  }
11697
11720
  }
11698
- else {
11721
+ else if (!this.parent.enableVirtualization) {
11699
11722
  index += findChildrenRecords(records[parseInt(index.toString(), 10)]).length;
11700
11723
  }
11701
11724
  }
@@ -12683,6 +12706,9 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
12683
12706
  }
12684
12707
  this.startIndex = !isLastBlock ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
12685
12708
  this.endIndex = lastIndex;
12709
+ if ((nextSetResIndex + this.parent.pageSettings.pageSize) > this.totalRecords && (this.endIndex - this.startIndex) < (this.parent.pageSettings.pageSize / 2) && (this.endIndex - nextSetResIndex) < (this.parent.pageSettings.pageSize / 2)) {
12710
+ this.startIndex = lastIndex - (this.parent.pageSettings.pageSize / 2);
12711
+ }
12686
12712
  if (currentViewData.length && this.startIndex > currentViewData[0][`${indexValue}`] &&
12687
12713
  ((this.startIndex - currentViewData[0][`${indexValue}`]) < (this.parent.pageSettings.pageSize / 2)) && this.parent.selectionModule.isRowSelected) {
12688
12714
  this.startIndex = currentViewData[0][`${indexValue}`] + (this.parent.pageSettings.pageSize / 2);
@@ -13016,7 +13042,7 @@ class VirtualScroll$1 {
13016
13042
  this.parent.grid.getContent().firstElementChild.scrollTop = 0;
13017
13043
  this.parent.grid.notify(virtualActionArgs, { setTop: true });
13018
13044
  }
13019
- if (requestType === 'save' && this.parent.editSettings.newRowPosition === 'Bottom') {
13045
+ if (requestType === 'save') {
13020
13046
  endIndex = counts.count;
13021
13047
  }
13022
13048
  //if ((this.prevendIndex !== -1 && this.prevstartIndex !== -1) &&