@syncfusion/ej2-treegrid 26.1.42 → 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];
@@ -1888,7 +1896,6 @@ class DataManipulation {
1888
1896
  this.hierarchyData = [];
1889
1897
  this.storedIndex = -1;
1890
1898
  this.sortedData = [];
1891
- this.preCurrentPage = -1;
1892
1899
  this.isSortAction = false;
1893
1900
  this.addEventListener();
1894
1901
  this.dataResults = {};
@@ -2212,7 +2219,7 @@ class DataManipulation {
2212
2219
  idMappingValue = rowDetails.record[this.parent.idMapping].toString();
2213
2220
  }
2214
2221
  if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2215
- qry.take(this.parent.grid.pageSettings.pageSize);
2222
+ qry.take(this.parent.pageSettings.pageSize);
2216
2223
  const expandDetail = [];
2217
2224
  expandDetail.push('ExpandingAction', idMappingValue.toString());
2218
2225
  qry.expand(expandDetail);
@@ -2400,17 +2407,6 @@ class DataManipulation {
2400
2407
  }
2401
2408
  datas.splice(inx + r + 1, 0, result[parseInt(r.toString(), 10)]);
2402
2409
  }
2403
- if (datas.length > result.length &&
2404
- datas.length !== this.parent.grid.pageSettings.pageSize + (this.parent.grid.contentModule).getBlockSize() &&
2405
- this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2406
- if ((this.preCurrentPage > 1 || this.parent.grid.pageSettings.currentPage > 1)) {
2407
- datas = datas.slice(0, this.parent.grid.pageSettings.pageSize + (this.parent.grid.contentModule).getBlockSize());
2408
- }
2409
- else {
2410
- datas = datas.slice(0, this.parent.grid.pageSettings.pageSize);
2411
- }
2412
- this.preCurrentPage = this.parent.grid.pageSettings.currentPage;
2413
- }
2414
2410
  setValue('result', datas, e);
2415
2411
  setValue('action', 'beforecontentrender', e);
2416
2412
  this.parent.trigger(actionComplete, e);
@@ -2430,6 +2426,9 @@ class DataManipulation {
2430
2426
  this.parent.grid.pageSettings.totalRecordsCount = e.count;
2431
2427
  }
2432
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
+ }
2433
2432
  const virtualArgs = {};
2434
2433
  if (this.parent.enableVirtualization) {
2435
2434
  this.remoteVirtualAction(virtualArgs);
@@ -4409,10 +4408,24 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4409
4408
  bindGridEvents() {
4410
4409
  this.grid.rowSelecting = (args) => {
4411
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
+ }
4412
4418
  this.trigger(rowSelecting, args);
4413
4419
  };
4414
4420
  this.grid.rowDeselecting = (args) => {
4415
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
+ }
4416
4429
  this.trigger(rowDeselecting, args);
4417
4430
  };
4418
4431
  this.grid.rowSelected = (args) => {
@@ -5155,7 +5168,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5155
5168
  onPropertyChanged(newProp) {
5156
5169
  const properties = Object.keys(newProp);
5157
5170
  let requireRefresh = false;
5158
- 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)) {
5159
5173
  this.grid.columns = this.getGridColumns(newProp.columns);
5160
5174
  this.grid['updateColumnObject']();
5161
5175
  requireRefresh = true;
@@ -6362,13 +6376,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6362
6376
  return e.hasChildRecords;
6363
6377
  });
6364
6378
  }
6365
- else if (isNullOrUndefined(record)) {
6379
+ else if (isNullOrUndefined(record) && !isNullOrUndefined(row)) {
6366
6380
  if (this.detailTemplate) {
6367
6381
  record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
6368
6382
  }
6369
6383
  else {
6370
- if (this.enableVirtualization && this.isCollapseAll) {
6371
- if (this.isExpandAll && row.rowIndex === -1) {
6384
+ if (this.enableVirtualization && (this.isCollapseAll || this.isExpandAll)) {
6385
+ if (row.rowIndex === -1) {
6372
6386
  record = this.grid.getCurrentViewRecords()[parseInt(row.getAttribute('data-rowindex'), 10)];
6373
6387
  }
6374
6388
  else {
@@ -6713,9 +6727,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6713
6727
  }
6714
6728
  expandCollapse(action, row, record, isChild) {
6715
6729
  const expandingArgs = { row: row, data: record, childData: [], requestType: action };
6716
- const childRecords = this.grid.currentViewData.filter((e) => {
6717
- return e.parentUniqueID === record.uniqueID;
6718
- });
6730
+ let childRecords;
6731
+ if (!isNullOrUndefined(record)) {
6732
+ childRecords = this.grid.currentViewData.filter((e) => {
6733
+ return e.parentUniqueID === record.uniqueID;
6734
+ });
6735
+ }
6719
6736
  let targetEle;
6720
6737
  if ((!isRemoteData(this) && action === 'expand' && this.isSelfReference && isCountRequired(this) && !childRecords.length) || (action === 'collapse' || (this.isExpandAll && this.loadChildOnDemand) && !isRemoteData(this) && this.isSelfReference && isCountRequired(this))) {
6721
6738
  this.updateChildOnDemand(expandingArgs);
@@ -6744,7 +6761,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6744
6761
  let displayAction;
6745
6762
  if (action === 'expand') {
6746
6763
  displayAction = 'table-row';
6747
- if (!isChild) {
6764
+ if (!isChild && !isNullOrUndefined(record)) {
6748
6765
  record.expanded = true;
6749
6766
  this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
6750
6767
  }
@@ -6765,7 +6782,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6765
6782
  }
6766
6783
  else {
6767
6784
  displayAction = 'none';
6768
- if (!isChild || isCountRequired(this)) {
6785
+ if ((!isChild || isCountRequired(this)) && !isNullOrUndefined(row)) {
6769
6786
  record.expanded = false;
6770
6787
  this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
6771
6788
  }
@@ -9548,13 +9565,7 @@ class TreeVirtualRowModelGenerator extends VirtualRowModelGenerator {
9548
9565
  else if (action === 'virtualscroll' && this.cache[parseInt(currentPage.toString(), 10)] &&
9549
9566
  this.cache[parseInt(currentPage.toString(), 10)].length >
9550
9567
  (this.parent.contentModule).getBlockSize()) {
9551
- if (this.cache[parseInt(currentPage.toString(), 10)].length > (this.parent.contentModule).getBlockSize()) {
9552
- this.cache[parseInt(currentPage.toString(), 10)] =
9553
- this.cache[parseInt(currentPage.toString(), 10)].slice(0, (this.parent.contentModule).getBlockSize());
9554
- }
9555
- else {
9556
- delete this.cache[parseInt(currentPage.toString(), 10)];
9557
- }
9568
+ delete this.cache[parseInt(currentPage.toString(), 10)];
9558
9569
  }
9559
9570
  }
9560
9571
  else {
@@ -13352,7 +13363,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13352
13363
  }
13353
13364
  appendContent(target, newChild, e) {
13354
13365
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
13355
- && !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)) {
13356
13367
  if (getValue('isExpandCollapse', e)) {
13357
13368
  this.isRemoteExpand = true;
13358
13369
  }
@@ -13623,7 +13634,7 @@ class VirtualScroll {
13623
13634
  }
13624
13635
  else {
13625
13636
  const requestType = pageingDetails.actionArgs.requestType;
13626
- if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' ||
13637
+ if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' || (requestType === 'refresh' && getValue('isExpandAll', this.parent)) ||
13627
13638
  (requestType === 'refresh' && this.parent.enableCollapseAll && endIndex > visualData.length && isNullOrUndefined(this.expandCollapseRec))) {
13628
13639
  startIndex = 0;
13629
13640
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
@@ -13664,7 +13675,7 @@ class VirtualScroll {
13664
13675
  }
13665
13676
  }
13666
13677
  //}
13667
- if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll') {
13678
+ if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll' && !isNullOrUndefined(this.parent.idMapping)) {
13668
13679
  startIndex = 0;
13669
13680
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
13670
13681
  this.parent.grid.notify(virtualActionArgs, { setTop: true });