@syncfusion/ej2-treegrid 26.1.41 → 26.2.4

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.
@@ -1042,6 +1042,7 @@ var Selection = /** @__PURE__ @class */ (function () {
1042
1042
  this.removeEventListener();
1043
1043
  };
1044
1044
  Selection.prototype.checkboxSelection = function (args) {
1045
+ var _a;
1045
1046
  var target = getObject('target', args);
1046
1047
  var checkWrap = parentsUntil(target, 'e-checkbox-wrapper');
1047
1048
  var checkBox;
@@ -1059,6 +1060,14 @@ var Selection = /** @__PURE__ @class */ (function () {
1059
1060
  checkBox = checkWrap.querySelector('input[type="checkbox"]');
1060
1061
  this.triggerChkChangeEvent(checkBox, checkBoxvalue, target.closest('tr'));
1061
1062
  }
1063
+ if (!isNullOrUndefined(this.parent['parentQuery']) && this.parent.selectionSettings.persistSelection
1064
+ && this.parent['columnModel'].filter(function (col) { return col.type === 'checkbox'; }).length > 0
1065
+ && isRemoteData(this.parent)) {
1066
+ if (this.parent['parentQuery'].length > 0) {
1067
+ (_a = this.parent.query.queries).push.apply(_a, this.parent['parentQuery']);
1068
+ this.parent['parentQuery'] = [];
1069
+ }
1070
+ }
1062
1071
  };
1063
1072
  Selection.prototype.triggerChkChangeEvent = function (checkBox, checkState, rowElement) {
1064
1073
  var data = this.parent.getCurrentViewRecords()[rowElement.rowIndex];
@@ -2585,6 +2594,9 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2585
2594
  _this.parent.grid.pageSettings.totalRecordsCount = e.count;
2586
2595
  }
2587
2596
  e.count = _this.parent.grid.pageSettings.totalRecordsCount;
2597
+ if (rowDetails.action === 'remoteExpand' && _this.parent.allowPaging) {
2598
+ _this.parent.grid.pageSettings.totalRecordsCount = _this.parent.grid.currentViewData.length + result.length;
2599
+ }
2588
2600
  var virtualArgs = {};
2589
2601
  if (_this.parent.enableVirtualization) {
2590
2602
  _this.remoteVirtualAction(virtualArgs);
@@ -4526,7 +4538,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4526
4538
  || (/[0-9]$/.test(this.height.toString()) && /[px]$/.test(this.height.toString()))) {
4527
4539
  failureCases.push('column width and height should be in pixels');
4528
4540
  }
4529
- if (!isNullOrUndefined(this.childMapping) && !isNullOrUndefined(this.idMapping)) {
4541
+ if ((this.childMapping !== 'Children') && !isNullOrUndefined(this.idMapping)) {
4530
4542
  failureCases.push('Both IdMapping and ChildMapping should not be used together for tree grid rendering.');
4531
4543
  }
4532
4544
  if ((!isNullOrUndefined(this.idMapping) && (isNullOrUndefined(this.parentIdMapping))) ||
@@ -4691,10 +4703,24 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4691
4703
  var _this = this;
4692
4704
  this.grid.rowSelecting = function (args) {
4693
4705
  _this.IsExpandCollapseClicked(args);
4706
+ if (!isNullOrUndefined(args.data) && _this.selectionSettings.persistSelection
4707
+ && _this.columnModel.filter(function (col) { return col.type === 'checkbox'; }).length > 0 && isRemoteData(_this)) {
4708
+ if (!isNullOrUndefined(args.data.parentItem)) {
4709
+ _this.parentQuery = _this.query.queries.filter(function (q) { return q.e.field === _this.parentIdMapping; });
4710
+ _this.query.queries = _this.query.queries.slice(0, 0);
4711
+ }
4712
+ }
4694
4713
  _this.trigger(rowSelecting, args);
4695
4714
  };
4696
4715
  this.grid.rowDeselecting = function (args) {
4697
4716
  _this.IsExpandCollapseClicked(args);
4717
+ if (isNullOrUndefined(args.data) && _this.selectionSettings.persistSelection
4718
+ && _this.columnModel.filter(function (col) { return col.type === 'checkbox'; }).length > 0 && isRemoteData(_this)) {
4719
+ if (isNullOrUndefined(args.data.parentItem)) {
4720
+ _this.parentQuery = _this.query.queries.filter(function (q) { return q.e.field === _this.parentIdMapping; });
4721
+ _this.query.queries = _this.query.queries.slice(0, 0);
4722
+ }
4723
+ }
4698
4724
  _this.trigger(rowDeselecting, args);
4699
4725
  };
4700
4726
  this.grid.rowSelected = function (args) {
@@ -5447,7 +5473,8 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5447
5473
  TreeGrid.prototype.onPropertyChanged = function (newProp) {
5448
5474
  var properties = Object.keys(newProp);
5449
5475
  var requireRefresh = false;
5450
- if (properties.indexOf('columns') > -1 && !isNullOrUndefined(newProp.columns)) {
5476
+ if (properties.indexOf('columns') > -1 && !isNullOrUndefined(newProp.columns) && this.frozenColumns === 0
5477
+ && this.frozenRows === 0 && !this.columnModel.some(function (col) { return col.isFrozen || col.freeze; })) {
5451
5478
  this.grid.columns = this.getGridColumns(newProp.columns);
5452
5479
  this.grid['updateColumnObject']();
5453
5480
  requireRefresh = true;
@@ -6659,13 +6686,13 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6659
6686
  return e.hasChildRecords;
6660
6687
  });
6661
6688
  }
6662
- else if (isNullOrUndefined(record)) {
6689
+ else if (isNullOrUndefined(record) && !isNullOrUndefined(row)) {
6663
6690
  if (this.detailTemplate) {
6664
6691
  record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
6665
6692
  }
6666
6693
  else {
6667
- if (this.enableVirtualization && this.isCollapseAll) {
6668
- if (this.isExpandAll && row.rowIndex === -1) {
6694
+ if (this.enableVirtualization && (this.isCollapseAll || this.isExpandAll)) {
6695
+ if (row.rowIndex === -1) {
6669
6696
  record = this.grid.getCurrentViewRecords()[parseInt(row.getAttribute('data-rowindex'), 10)];
6670
6697
  }
6671
6698
  else {
@@ -7018,9 +7045,12 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7018
7045
  TreeGrid.prototype.expandCollapse = function (action, row, record, isChild) {
7019
7046
  var _this = this;
7020
7047
  var expandingArgs = { row: row, data: record, childData: [], requestType: action };
7021
- var childRecords = this.grid.currentViewData.filter(function (e) {
7022
- return e.parentUniqueID === record.uniqueID;
7023
- });
7048
+ var childRecords;
7049
+ if (!isNullOrUndefined(record)) {
7050
+ childRecords = this.grid.currentViewData.filter(function (e) {
7051
+ return e.parentUniqueID === record.uniqueID;
7052
+ });
7053
+ }
7024
7054
  var targetEle;
7025
7055
  if ((!isRemoteData(this) && action === 'expand' && this.isSelfReference && isCountRequired(this) && !childRecords.length) || (action === 'collapse' || (this.isExpandAll && this.loadChildOnDemand) && !isRemoteData(this) && this.isSelfReference && isCountRequired(this))) {
7026
7056
  this.updateChildOnDemand(expandingArgs);
@@ -7049,7 +7079,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7049
7079
  var displayAction = void 0;
7050
7080
  if (action === 'expand') {
7051
7081
  displayAction = 'table-row';
7052
- if (!isChild) {
7082
+ if (!isChild && !isNullOrUndefined(record)) {
7053
7083
  record.expanded = true;
7054
7084
  this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
7055
7085
  }
@@ -7070,7 +7100,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7070
7100
  }
7071
7101
  else {
7072
7102
  displayAction = 'none';
7073
- if (!isChild || isCountRequired(this)) {
7103
+ if ((!isChild || isCountRequired(this)) && !isNullOrUndefined(row)) {
7074
7104
  record.expanded = false;
7075
7105
  this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
7076
7106
  }
@@ -13764,7 +13794,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13764
13794
  };
13765
13795
  VirtualTreeContentRenderer.prototype.appendContent = function (target, newChild, e) {
13766
13796
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
13767
- && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent) || this.parent.isFrozenGrid()) {
13797
+ && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent)) {
13768
13798
  if (getValue('isExpandCollapse', e)) {
13769
13799
  this.isRemoteExpand = true;
13770
13800
  }
@@ -14054,7 +14084,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14054
14084
  }
14055
14085
  else {
14056
14086
  var requestType = pageingDetails.actionArgs.requestType;
14057
- if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' ||
14087
+ if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' || (requestType === 'refresh' && getValue('isExpandAll', this.parent)) ||
14058
14088
  (requestType === 'refresh' && this.parent.enableCollapseAll && endIndex > visualData.length && isNullOrUndefined(this.expandCollapseRec))) {
14059
14089
  startIndex = 0;
14060
14090
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
@@ -14095,7 +14125,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14095
14125
  }
14096
14126
  }
14097
14127
  //}
14098
- if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll') {
14128
+ if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll' && !isNullOrUndefined(this.parent.idMapping)) {
14099
14129
  startIndex = 0;
14100
14130
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
14101
14131
  this.parent.grid.notify(virtualActionArgs, { setTop: true });