@syncfusion/ej2-treegrid 21.1.41 → 21.2.3

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.
@@ -1503,10 +1503,12 @@ class Render {
1503
1503
  const collapsed$$1 = (this.parent.initialRender && (!(isNullOrUndefined(parentData[this.parent.expandStateMapping]) ||
1504
1504
  parentData[this.parent.expandStateMapping]) || this.parent.enableCollapseAll)) ||
1505
1505
  !getExpandStatus(this.parent, args.data, this.parent.grid.getCurrentViewRecords());
1506
- if (collapsed$$1) {
1506
+ if (collapsed$$1 && !isNullOrUndefined(args.row)) {
1507
1507
  args.row.style.display = 'none';
1508
1508
  const rowsObj = this.parent.grid.getRowsObject();
1509
- rowsObj.filter((e) => e.uid === args.row.getAttribute('data-uid'))[0].visible = false;
1509
+ if (!isNullOrUndefined(args.row.getAttribute('data-uid'))) {
1510
+ rowsObj.filter((e) => e.uid === args.row.getAttribute('data-uid'))[0].visible = false;
1511
+ }
1510
1512
  }
1511
1513
  }
1512
1514
  if (isRemoteData(this.parent) && !isOffline(this.parent)) {
@@ -1514,7 +1516,7 @@ class Render {
1514
1516
  const parentrec = this.parent.getCurrentViewRecords().filter((rec) => {
1515
1517
  return getValue(proxy.idMapping, rec) === getValue(proxy.parentIdMapping, data);
1516
1518
  });
1517
- if (parentrec.length > 0 && !parentrec[0].isSummaryRow) {
1519
+ if (parentrec.length > 0 && !parentrec[0].isSummaryRow && !isNullOrUndefined(args.row)) {
1518
1520
  const display = parentrec[0].expanded ? 'table-row' : 'none';
1519
1521
  args.row.setAttribute('style', 'display: ' + display + ';');
1520
1522
  }
@@ -1524,15 +1526,17 @@ class Render {
1524
1526
  if (summaryRow) {
1525
1527
  addClass([args.row], 'e-summaryrow');
1526
1528
  }
1527
- if (args.row.querySelector('.e-treegridexpand')) {
1528
- args.row.setAttribute('aria-expanded', 'true');
1529
- }
1530
- else if (args.row.querySelector('.e-treegridcollapse')) {
1531
- args.row.setAttribute('aria-expanded', 'false');
1532
- }
1533
- if (this.parent.enableCollapseAll && this.parent.initialRender) {
1534
- if (!isNullOrUndefined(data.parentItem)) {
1535
- args.row.style.display = 'none';
1529
+ if (!isNullOrUndefined(args.row)) {
1530
+ if (args.row.querySelector('.e-treegridexpand')) {
1531
+ args.row.setAttribute('aria-expanded', 'true');
1532
+ }
1533
+ else if (args.row.querySelector('.e-treegridcollapse')) {
1534
+ args.row.setAttribute('aria-expanded', 'false');
1535
+ }
1536
+ if (this.parent.enableCollapseAll && this.parent.initialRender) {
1537
+ if (!isNullOrUndefined(data.parentItem)) {
1538
+ args.row.style.display = 'none';
1539
+ }
1536
1540
  }
1537
1541
  }
1538
1542
  const dragStartData = 'dragStartData';
@@ -4285,7 +4289,24 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4285
4289
  };
4286
4290
  }
4287
4291
  updateRowTemplate() {
4288
- this.treeColumnRowTemplate();
4292
+ if (this.rowTemplate) {
4293
+ if (this.isReact && this.getContentTable().rows.length === 0) {
4294
+ setTimeout(() => {
4295
+ this.treeColumnRowTemplate();
4296
+ if (this.enableCollapseAll) {
4297
+ const currentData = this.getCurrentViewRecords();
4298
+ const rows = this.getContentTable().rows;
4299
+ for (let i = 0; i < rows.length; i++) {
4300
+ let args = { data: currentData[parseInt(i.toString(), 10)], row: rows[parseInt(i.toString(), 10)] };
4301
+ this.renderModule.RowModifier(args);
4302
+ }
4303
+ }
4304
+ }, 0);
4305
+ }
4306
+ else {
4307
+ this.treeColumnRowTemplate();
4308
+ }
4309
+ }
4289
4310
  }
4290
4311
  bindedDataSource() {
4291
4312
  const dataSource = 'dataSource';
@@ -4327,22 +4348,6 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4327
4348
  if (requestType === 'reorder') {
4328
4349
  this.notify('getColumnIndex', {});
4329
4350
  }
4330
- if (requestType === 'filterbeforeopen' && args.columnName && this.filterSettings.hierarchyMode !== 'None') {
4331
- for (let j = 0; j < this.columns.length; j++) {
4332
- const fields = 'field';
4333
- if (this.columns[parseInt(j.toString(), 10)][`${fields}`] === args.columnName) {
4334
- const taskFields = [];
4335
- for (let i = 0; i < this.grid.currentViewData.length; i++) {
4336
- const fieldValue = this.grid.currentViewData[parseInt(i.toString(), 10)][args.columnName];
4337
- if (taskFields.indexOf(fieldValue) === -1) {
4338
- taskFields.push(fieldValue);
4339
- }
4340
- }
4341
- args['filterModel'].options.dataSource = taskFields.map((name) => ({ [args.columnName]: name }));
4342
- args['filterModel'].options.filteredColumns = args['filterModel'].options.filteredColumns.filter((col) => col.field === args.columnName);
4343
- }
4344
- }
4345
- }
4346
4351
  if (isRemoteData(this) && this.enableVirtualization) {
4347
4352
  if (args.requestType === 'virtualscroll') {
4348
4353
  this.query.expand('VirtualScrollingAction');
@@ -6443,17 +6448,15 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6443
6448
  }
6444
6449
  }
6445
6450
  treeColumnRowTemplate() {
6446
- if (this.rowTemplate) {
6447
- let rows = this.getContentTable().rows;
6448
- rows = [].slice.call(rows);
6449
- for (let i = 0; i < rows.length; i++) {
6450
- const rcell = this.grid.getContentTable().rows[parseInt(i.toString(), 10)]
6451
- .cells[this.treeColumnIndex];
6452
- const row = rows[parseInt(i.toString(), 10)];
6453
- const rowData = this.grid.getRowsObject()[parseInt(i.toString(), 10)].data;
6454
- const arg = { data: rowData, row: row, cell: rcell, column: this.getColumns()[this.treeColumnIndex] };
6455
- this.renderModule.cellRender(arg);
6456
- }
6451
+ let rows = this.getContentTable().rows;
6452
+ rows = [].slice.call(rows);
6453
+ for (let i = 0; i < rows.length; i++) {
6454
+ const rcell = this.grid.getContentTable().rows[parseInt(i.toString(), 10)]
6455
+ .cells[this.treeColumnIndex];
6456
+ const row = rows[parseInt(i.toString(), 10)];
6457
+ const rowData = this.grid.getRowsObject()[parseInt(i.toString(), 10)].data;
6458
+ const arg = { data: rowData, row: row, cell: rcell, column: this.getColumns()[this.treeColumnIndex] };
6459
+ this.renderModule.cellRender(arg);
6457
6460
  }
6458
6461
  }
6459
6462
  collapseRemoteChild(rowDetails, isChild) {