@syncfusion/ej2-treegrid 26.1.42 → 26.2.5

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];
@@ -2047,7 +2056,6 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2047
2056
  this.hierarchyData = [];
2048
2057
  this.storedIndex = -1;
2049
2058
  this.sortedData = [];
2050
- this.preCurrentPage = -1;
2051
2059
  this.isSortAction = false;
2052
2060
  this.addEventListener();
2053
2061
  this.dataResults = {};
@@ -2379,7 +2387,7 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2379
2387
  idMappingValue = rowDetails.record[this.parent.idMapping].toString();
2380
2388
  }
2381
2389
  if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2382
- qry.take(this.parent.grid.pageSettings.pageSize);
2390
+ qry.take(this.parent.pageSettings.pageSize);
2383
2391
  var expandDetail = [];
2384
2392
  expandDetail.push('ExpandingAction', idMappingValue.toString());
2385
2393
  qry.expand(expandDetail);
@@ -2567,17 +2575,6 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2567
2575
  }
2568
2576
  datas.splice(inx + r + 1, 0, result[parseInt(r.toString(), 10)]);
2569
2577
  }
2570
- if (datas.length > result.length &&
2571
- datas.length !== _this.parent.grid.pageSettings.pageSize + (_this.parent.grid.contentModule).getBlockSize() &&
2572
- _this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2573
- if ((_this.preCurrentPage > 1 || _this.parent.grid.pageSettings.currentPage > 1)) {
2574
- datas = datas.slice(0, _this.parent.grid.pageSettings.pageSize + (_this.parent.grid.contentModule).getBlockSize());
2575
- }
2576
- else {
2577
- datas = datas.slice(0, _this.parent.grid.pageSettings.pageSize);
2578
- }
2579
- _this.preCurrentPage = _this.parent.grid.pageSettings.currentPage;
2580
- }
2581
2578
  setValue('result', datas, e);
2582
2579
  setValue('action', 'beforecontentrender', e);
2583
2580
  _this.parent.trigger(actionComplete, e);
@@ -2597,6 +2594,9 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2597
2594
  _this.parent.grid.pageSettings.totalRecordsCount = e.count;
2598
2595
  }
2599
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
+ }
2600
2600
  var virtualArgs = {};
2601
2601
  if (_this.parent.enableVirtualization) {
2602
2602
  _this.remoteVirtualAction(virtualArgs);
@@ -4703,10 +4703,24 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4703
4703
  var _this = this;
4704
4704
  this.grid.rowSelecting = function (args) {
4705
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
+ }
4706
4713
  _this.trigger(rowSelecting, args);
4707
4714
  };
4708
4715
  this.grid.rowDeselecting = function (args) {
4709
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
+ }
4710
4724
  _this.trigger(rowDeselecting, args);
4711
4725
  };
4712
4726
  this.grid.rowSelected = function (args) {
@@ -5459,7 +5473,8 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5459
5473
  TreeGrid.prototype.onPropertyChanged = function (newProp) {
5460
5474
  var properties = Object.keys(newProp);
5461
5475
  var requireRefresh = false;
5462
- 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; })) {
5463
5478
  this.grid.columns = this.getGridColumns(newProp.columns);
5464
5479
  this.grid['updateColumnObject']();
5465
5480
  requireRefresh = true;
@@ -6671,13 +6686,13 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6671
6686
  return e.hasChildRecords;
6672
6687
  });
6673
6688
  }
6674
- else if (isNullOrUndefined(record)) {
6689
+ else if (isNullOrUndefined(record) && !isNullOrUndefined(row)) {
6675
6690
  if (this.detailTemplate) {
6676
6691
  record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
6677
6692
  }
6678
6693
  else {
6679
- if (this.enableVirtualization && this.isCollapseAll) {
6680
- if (this.isExpandAll && row.rowIndex === -1) {
6694
+ if (this.enableVirtualization && (this.isCollapseAll || this.isExpandAll)) {
6695
+ if (row.rowIndex === -1) {
6681
6696
  record = this.grid.getCurrentViewRecords()[parseInt(row.getAttribute('data-rowindex'), 10)];
6682
6697
  }
6683
6698
  else {
@@ -7030,9 +7045,12 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7030
7045
  TreeGrid.prototype.expandCollapse = function (action, row, record, isChild) {
7031
7046
  var _this = this;
7032
7047
  var expandingArgs = { row: row, data: record, childData: [], requestType: action };
7033
- var childRecords = this.grid.currentViewData.filter(function (e) {
7034
- return e.parentUniqueID === record.uniqueID;
7035
- });
7048
+ var childRecords;
7049
+ if (!isNullOrUndefined(record)) {
7050
+ childRecords = this.grid.currentViewData.filter(function (e) {
7051
+ return e.parentUniqueID === record.uniqueID;
7052
+ });
7053
+ }
7036
7054
  var targetEle;
7037
7055
  if ((!isRemoteData(this) && action === 'expand' && this.isSelfReference && isCountRequired(this) && !childRecords.length) || (action === 'collapse' || (this.isExpandAll && this.loadChildOnDemand) && !isRemoteData(this) && this.isSelfReference && isCountRequired(this))) {
7038
7056
  this.updateChildOnDemand(expandingArgs);
@@ -7061,7 +7079,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7061
7079
  var displayAction = void 0;
7062
7080
  if (action === 'expand') {
7063
7081
  displayAction = 'table-row';
7064
- if (!isChild) {
7082
+ if (!isChild && !isNullOrUndefined(record)) {
7065
7083
  record.expanded = true;
7066
7084
  this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
7067
7085
  }
@@ -7082,7 +7100,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7082
7100
  }
7083
7101
  else {
7084
7102
  displayAction = 'none';
7085
- if (!isChild || isCountRequired(this)) {
7103
+ if ((!isChild || isCountRequired(this)) && !isNullOrUndefined(row)) {
7086
7104
  record.expanded = false;
7087
7105
  this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
7088
7106
  }
@@ -9926,13 +9944,7 @@ var TreeVirtualRowModelGenerator = /** @__PURE__ @class */ (function (_super) {
9926
9944
  else if (action === 'virtualscroll' && this.cache[parseInt(currentPage.toString(), 10)] &&
9927
9945
  this.cache[parseInt(currentPage.toString(), 10)].length >
9928
9946
  (this.parent.contentModule).getBlockSize()) {
9929
- if (this.cache[parseInt(currentPage.toString(), 10)].length > (this.parent.contentModule).getBlockSize()) {
9930
- this.cache[parseInt(currentPage.toString(), 10)] =
9931
- this.cache[parseInt(currentPage.toString(), 10)].slice(0, (this.parent.contentModule).getBlockSize());
9932
- }
9933
- else {
9934
- delete this.cache[parseInt(currentPage.toString(), 10)];
9935
- }
9947
+ delete this.cache[parseInt(currentPage.toString(), 10)];
9936
9948
  }
9937
9949
  }
9938
9950
  else {
@@ -13782,7 +13794,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13782
13794
  };
13783
13795
  VirtualTreeContentRenderer.prototype.appendContent = function (target, newChild, e) {
13784
13796
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
13785
- && !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)) {
13786
13798
  if (getValue('isExpandCollapse', e)) {
13787
13799
  this.isRemoteExpand = true;
13788
13800
  }
@@ -14072,7 +14084,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14072
14084
  }
14073
14085
  else {
14074
14086
  var requestType = pageingDetails.actionArgs.requestType;
14075
- if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' ||
14087
+ if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' || (requestType === 'refresh' && getValue('isExpandAll', this.parent)) ||
14076
14088
  (requestType === 'refresh' && this.parent.enableCollapseAll && endIndex > visualData.length && isNullOrUndefined(this.expandCollapseRec))) {
14077
14089
  startIndex = 0;
14078
14090
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
@@ -14113,7 +14125,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14113
14125
  }
14114
14126
  }
14115
14127
  //}
14116
- if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll') {
14128
+ if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll' && !isNullOrUndefined(this.parent.idMapping)) {
14117
14129
  startIndex = 0;
14118
14130
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
14119
14131
  this.parent.grid.notify(virtualActionArgs, { setTop: true });