@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.
@@ -2334,7 +2334,18 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2334
2334
  }
2335
2335
  result = resultChildData;
2336
2336
  }
2337
- rowDetails.record.childRecords = result;
2337
+ if (_this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2338
+ rowDetails.record.childRecords = [];
2339
+ for (var i = 0; i < result.length; i++) {
2340
+ if (rowDetails.record['' + _this.parent.idMapping] !== result[parseInt(i.toString(), 10)]['' + _this.parent.idMapping] &&
2341
+ rowDetails.record['' + _this.parent.idMapping] === result[parseInt(i.toString(), 10)]['' + _this.parent.parentIdMapping] && Object.prototype.hasOwnProperty.call(result, i)) {
2342
+ rowDetails.record.childRecords.push(result[parseInt(i.toString(), 10)]);
2343
+ }
2344
+ }
2345
+ }
2346
+ else {
2347
+ rowDetails.record.childRecords = result;
2348
+ }
2338
2349
  for (var r = 0; r < result.length; r++) {
2339
2350
  if (_this.parent.enableVirtualization && result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping] === rowDetails.record["" + _this.parent.idMapping] && rowDetails.action === 'remoteExpand') {
2340
2351
  _this.parent["" + remoteExpandedData].push(rowDetails.record);
@@ -2352,6 +2363,7 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2352
2363
  if (result[parseInt(r.toString(), 10)]["" + _this.parent.parentIdMapping] === _this.parent["" + remoteExpandedData][parseInt(i.toString(), 10)]["" + _this.parent.idMapping]) {
2353
2364
  result[parseInt(r.toString(), 10)].level = _this.parent["" + remoteExpandedData][parseInt(i.toString(), 10)]["" + level] + 1;
2354
2365
  var parentData = _this.parent["" + remoteExpandedData][parseInt(i.toString(), 10)];
2366
+ delete parentData.childRecords;
2355
2367
  result[parseInt(r.toString(), 10)].parentItem = parentData;
2356
2368
  result[parseInt(r.toString(), 10)].parentUniqueID = rowDetails.record.uniqueID;
2357
2369
  }
@@ -2363,6 +2375,10 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2363
2375
  && !(haveChild && !haveChild[parseInt(r.toString(), 10)])) {
2364
2376
  if (isNullOrUndefined(result[parseInt(r.toString(), 10)]["" + _this.parent.parentIdMapping])) {
2365
2377
  result[parseInt(r.toString(), 10)].level = 0;
2378
+ if (rowDetails.action === 'remoteExpand') {
2379
+ result[parseInt(r.toString(), 10)].childRecords = [];
2380
+ result[parseInt(r.toString(), 10)].childRecords = rowDetails.record.childRecords;
2381
+ }
2366
2382
  }
2367
2383
  else {
2368
2384
  result[parseInt(r.toString(), 10)].level = rowDetails.record.level;
@@ -6174,7 +6190,12 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6174
6190
  record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
6175
6191
  }
6176
6192
  else {
6177
- record = this.grid.getCurrentViewRecords()[parseInt(row.getAttribute('data-rowindex'), 10)];
6193
+ if (this.enableVirtualization && this.isCollapseAll) {
6194
+ record = this.grid.getCurrentViewRecords()[row.rowIndex];
6195
+ }
6196
+ else {
6197
+ record = this.grid.getCurrentViewRecords()[parseInt(row.getAttribute('data-rowindex'), 10)];
6198
+ }
6178
6199
  }
6179
6200
  }
6180
6201
  return record;
@@ -6404,7 +6425,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6404
6425
  if (rows.length) {
6405
6426
  for (var i = 0; i < rows.length; i++) {
6406
6427
  if (action === 'collapse') {
6407
- this.collapseRow(rows[parseInt(i.toString(), 10)]);
6428
+ if (!isNullOrUndefined(this.getCurrentViewRecords()[rows[parseInt(i.toString(), 10)].rowIndex])) {
6429
+ this.collapseRow(rows[parseInt(i.toString(), 10)]);
6430
+ }
6408
6431
  }
6409
6432
  else {
6410
6433
  this.expandRow(rows[parseInt(i.toString(), 10)]);
@@ -12074,7 +12097,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
12074
12097
  index = index + batchChildCount;
12075
12098
  }
12076
12099
  }
12077
- else {
12100
+ else if (!this.parent.enableVirtualization) {
12078
12101
  index += findChildrenRecords(records[parseInt(index.toString(), 10)]).length;
12079
12102
  }
12080
12103
  }
@@ -13086,6 +13109,9 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13086
13109
  }
13087
13110
  this.startIndex = !isLastBlock ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
13088
13111
  this.endIndex = lastIndex;
13112
+ 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)) {
13113
+ this.startIndex = lastIndex - (this.parent.pageSettings.pageSize / 2);
13114
+ }
13089
13115
  if (currentViewData.length && this.startIndex > currentViewData[0]["" + indexValue] &&
13090
13116
  ((this.startIndex - currentViewData[0]["" + indexValue]) < (this.parent.pageSettings.pageSize / 2)) && this.parent.selectionModule.isRowSelected) {
13091
13117
  this.startIndex = currentViewData[0]["" + indexValue] + (this.parent.pageSettings.pageSize / 2);
@@ -13438,7 +13464,7 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
13438
13464
  this.parent.grid.getContent().firstElementChild.scrollTop = 0;
13439
13465
  this.parent.grid.notify(virtualActionArgs, { setTop: true });
13440
13466
  }
13441
- if (requestType === 'save' && this.parent.editSettings.newRowPosition === 'Bottom') {
13467
+ if (requestType === 'save') {
13442
13468
  endIndex = counts.count;
13443
13469
  }
13444
13470
  //if ((this.prevendIndex !== -1 && this.prevstartIndex !== -1) &&