@syncfusion/ej2-treegrid 21.1.38 → 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,20 +1526,23 @@ 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
  }
1542
+ const dragStartData = 'dragStartData';
1538
1543
  const draggedRecord = 'draggedRecord';
1539
- if (!isNullOrUndefined(this.parent.rowDragAndDropModule) && !isNullOrUndefined(this.parent.rowDragAndDropModule[`${draggedRecord}`])
1540
- && this.parent.getContentTable().scrollHeight <= this.parent.getContent().clientHeight) {
1544
+ if (this.parent.rowDragAndDropModule && this.parent.grid.rowDragAndDropModule && (this.parent.grid.rowDragAndDropModule[`${dragStartData}`] ||
1545
+ this.parent.rowDragAndDropModule[`${draggedRecord}`]) && this.parent.getContentTable().scrollHeight <= this.parent.getContent().clientHeight) {
1541
1546
  const lastRowBorder = 'lastRowBorder';
1542
1547
  const lastVisualData = this.parent.getVisibleRecords()[this.parent.getVisibleRecords().length - 1];
1543
1548
  if (lastVisualData.uniqueID === args.data.uniqueID && !isNullOrUndefined(args.row) && !args.row.cells[0].classList.contains('e-lastrowcell')) {
@@ -4284,7 +4289,24 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4284
4289
  };
4285
4290
  }
4286
4291
  updateRowTemplate() {
4287
- 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
+ }
4288
4310
  }
4289
4311
  bindedDataSource() {
4290
4312
  const dataSource = 'dataSource';
@@ -6426,17 +6448,15 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6426
6448
  }
6427
6449
  }
6428
6450
  treeColumnRowTemplate() {
6429
- if (this.rowTemplate) {
6430
- let rows = this.getContentTable().rows;
6431
- rows = [].slice.call(rows);
6432
- for (let i = 0; i < rows.length; i++) {
6433
- const rcell = this.grid.getContentTable().rows[parseInt(i.toString(), 10)]
6434
- .cells[this.treeColumnIndex];
6435
- const row = rows[parseInt(i.toString(), 10)];
6436
- const rowData = this.grid.getRowsObject()[parseInt(i.toString(), 10)].data;
6437
- const arg = { data: rowData, row: row, cell: rcell, column: this.getColumns()[this.treeColumnIndex] };
6438
- this.renderModule.cellRender(arg);
6439
- }
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);
6440
6460
  }
6441
6461
  }
6442
6462
  collapseRemoteChild(rowDetails, isChild) {