@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.
@@ -943,6 +943,14 @@ class Selection {
943
943
  checkBox = checkWrap.querySelector('input[type="checkbox"]');
944
944
  this.triggerChkChangeEvent(checkBox, checkBoxvalue, target.closest('tr'));
945
945
  }
946
+ if (!isNullOrUndefined(this.parent['parentQuery']) && this.parent.selectionSettings.persistSelection
947
+ && this.parent['columnModel'].filter((col) => { return col.type === 'checkbox'; }).length > 0
948
+ && isRemoteData(this.parent)) {
949
+ if (this.parent['parentQuery'].length > 0) {
950
+ this.parent.query.queries.push(...this.parent['parentQuery']);
951
+ this.parent['parentQuery'] = [];
952
+ }
953
+ }
946
954
  }
947
955
  triggerChkChangeEvent(checkBox, checkState, rowElement) {
948
956
  const data = this.parent.getCurrentViewRecords()[rowElement.rowIndex];
@@ -2418,6 +2426,9 @@ class DataManipulation {
2418
2426
  this.parent.grid.pageSettings.totalRecordsCount = e.count;
2419
2427
  }
2420
2428
  e.count = this.parent.grid.pageSettings.totalRecordsCount;
2429
+ if (rowDetails.action === 'remoteExpand' && this.parent.allowPaging) {
2430
+ this.parent.grid.pageSettings.totalRecordsCount = this.parent.grid.currentViewData.length + result.length;
2431
+ }
2421
2432
  const virtualArgs = {};
2422
2433
  if (this.parent.enableVirtualization) {
2423
2434
  this.remoteVirtualAction(virtualArgs);
@@ -4234,7 +4245,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4234
4245
  || (/[0-9]$/.test(this.height.toString()) && /[px]$/.test(this.height.toString()))) {
4235
4246
  failureCases.push('column width and height should be in pixels');
4236
4247
  }
4237
- if (!isNullOrUndefined(this.childMapping) && !isNullOrUndefined(this.idMapping)) {
4248
+ if ((this.childMapping !== 'Children') && !isNullOrUndefined(this.idMapping)) {
4238
4249
  failureCases.push('Both IdMapping and ChildMapping should not be used together for tree grid rendering.');
4239
4250
  }
4240
4251
  if ((!isNullOrUndefined(this.idMapping) && (isNullOrUndefined(this.parentIdMapping))) ||
@@ -4397,10 +4408,24 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4397
4408
  bindGridEvents() {
4398
4409
  this.grid.rowSelecting = (args) => {
4399
4410
  this.IsExpandCollapseClicked(args);
4411
+ if (!isNullOrUndefined(args.data) && this.selectionSettings.persistSelection
4412
+ && this.columnModel.filter((col) => col.type === 'checkbox').length > 0 && isRemoteData(this)) {
4413
+ if (!isNullOrUndefined(args.data.parentItem)) {
4414
+ this.parentQuery = this.query.queries.filter((q) => q.e.field === this.parentIdMapping);
4415
+ this.query.queries = this.query.queries.slice(0, 0);
4416
+ }
4417
+ }
4400
4418
  this.trigger(rowSelecting, args);
4401
4419
  };
4402
4420
  this.grid.rowDeselecting = (args) => {
4403
4421
  this.IsExpandCollapseClicked(args);
4422
+ if (isNullOrUndefined(args.data) && this.selectionSettings.persistSelection
4423
+ && this.columnModel.filter((col) => col.type === 'checkbox').length > 0 && isRemoteData(this)) {
4424
+ if (isNullOrUndefined(args.data.parentItem)) {
4425
+ this.parentQuery = this.query.queries.filter((q) => q.e.field === this.parentIdMapping);
4426
+ this.query.queries = this.query.queries.slice(0, 0);
4427
+ }
4428
+ }
4404
4429
  this.trigger(rowDeselecting, args);
4405
4430
  };
4406
4431
  this.grid.rowSelected = (args) => {
@@ -5143,7 +5168,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5143
5168
  onPropertyChanged(newProp) {
5144
5169
  const properties = Object.keys(newProp);
5145
5170
  let requireRefresh = false;
5146
- if (properties.indexOf('columns') > -1 && !isNullOrUndefined(newProp.columns)) {
5171
+ if (properties.indexOf('columns') > -1 && !isNullOrUndefined(newProp.columns) && this.frozenColumns === 0
5172
+ && this.frozenRows === 0 && !this.columnModel.some((col) => col.isFrozen || col.freeze)) {
5147
5173
  this.grid.columns = this.getGridColumns(newProp.columns);
5148
5174
  this.grid['updateColumnObject']();
5149
5175
  requireRefresh = true;
@@ -6350,13 +6376,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6350
6376
  return e.hasChildRecords;
6351
6377
  });
6352
6378
  }
6353
- else if (isNullOrUndefined(record)) {
6379
+ else if (isNullOrUndefined(record) && !isNullOrUndefined(row)) {
6354
6380
  if (this.detailTemplate) {
6355
6381
  record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
6356
6382
  }
6357
6383
  else {
6358
- if (this.enableVirtualization && this.isCollapseAll) {
6359
- if (this.isExpandAll && row.rowIndex === -1) {
6384
+ if (this.enableVirtualization && (this.isCollapseAll || this.isExpandAll)) {
6385
+ if (row.rowIndex === -1) {
6360
6386
  record = this.grid.getCurrentViewRecords()[parseInt(row.getAttribute('data-rowindex'), 10)];
6361
6387
  }
6362
6388
  else {
@@ -6701,9 +6727,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6701
6727
  }
6702
6728
  expandCollapse(action, row, record, isChild) {
6703
6729
  const expandingArgs = { row: row, data: record, childData: [], requestType: action };
6704
- const childRecords = this.grid.currentViewData.filter((e) => {
6705
- return e.parentUniqueID === record.uniqueID;
6706
- });
6730
+ let childRecords;
6731
+ if (!isNullOrUndefined(record)) {
6732
+ childRecords = this.grid.currentViewData.filter((e) => {
6733
+ return e.parentUniqueID === record.uniqueID;
6734
+ });
6735
+ }
6707
6736
  let targetEle;
6708
6737
  if ((!isRemoteData(this) && action === 'expand' && this.isSelfReference && isCountRequired(this) && !childRecords.length) || (action === 'collapse' || (this.isExpandAll && this.loadChildOnDemand) && !isRemoteData(this) && this.isSelfReference && isCountRequired(this))) {
6709
6738
  this.updateChildOnDemand(expandingArgs);
@@ -6732,7 +6761,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6732
6761
  let displayAction;
6733
6762
  if (action === 'expand') {
6734
6763
  displayAction = 'table-row';
6735
- if (!isChild) {
6764
+ if (!isChild && !isNullOrUndefined(record)) {
6736
6765
  record.expanded = true;
6737
6766
  this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
6738
6767
  }
@@ -6753,7 +6782,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6753
6782
  }
6754
6783
  else {
6755
6784
  displayAction = 'none';
6756
- if (!isChild || isCountRequired(this)) {
6785
+ if ((!isChild || isCountRequired(this)) && !isNullOrUndefined(row)) {
6757
6786
  record.expanded = false;
6758
6787
  this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
6759
6788
  }
@@ -13334,7 +13363,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13334
13363
  }
13335
13364
  appendContent(target, newChild, e) {
13336
13365
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
13337
- && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent) || this.parent.isFrozenGrid()) {
13366
+ && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent)) {
13338
13367
  if (getValue('isExpandCollapse', e)) {
13339
13368
  this.isRemoteExpand = true;
13340
13369
  }
@@ -13605,7 +13634,7 @@ class VirtualScroll {
13605
13634
  }
13606
13635
  else {
13607
13636
  const requestType = pageingDetails.actionArgs.requestType;
13608
- if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' ||
13637
+ if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' || (requestType === 'refresh' && getValue('isExpandAll', this.parent)) ||
13609
13638
  (requestType === 'refresh' && this.parent.enableCollapseAll && endIndex > visualData.length && isNullOrUndefined(this.expandCollapseRec))) {
13610
13639
  startIndex = 0;
13611
13640
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
@@ -13646,7 +13675,7 @@ class VirtualScroll {
13646
13675
  }
13647
13676
  }
13648
13677
  //}
13649
- if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll') {
13678
+ if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll' && !isNullOrUndefined(this.parent.idMapping)) {
13650
13679
  startIndex = 0;
13651
13680
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
13652
13681
  this.parent.grid.notify(virtualActionArgs, { setTop: true });