Open mrguamos opened 4 years ago
I don't know if this is the same error but the same scenario is happening in the ngx-admin demo
as a workaround I hid the nb-tree-grid-row-toggle and used an icon toggling the right and down arrow.
<table [nbTreeGrid]="data">
<tr nbTreeGridRow *nbTreeGridRowDef="let row; columns: allColumns"></tr>
<ng-container [nbTreeGridColumnDef]="customColumn">
<td nbTreeGridCell *nbTreeGridCellDef="let row" class="hover">
<span>
{{row.data.name}}
</span>
<span class="pl-2" *ngIf="!row.expanded && row.data.kind === 'Title'"><i class="fas fa-chevron-right fa-xs"></i></span>
<span class="pl-2" *ngIf="row.expanded && row.data.kind === 'Title'"><i class="fas fa-chevron-down fa-xs"></i></span>
<nb-tree-grid-row-toggle [expanded]="row.expanded" *ngIf="row.data.kind === 'Title'"
style="visibility: hidden;">
</nb-tree-grid-row-toggle>
</td>
</ng-container>
<ng-container *ngFor="let column of defaultColumns" [nbTreeGridColumnDef]="column">
<td nbTreeGridCell *nbTreeGridCellDef="let row">
{{row.data[column]}}
</td>
</ng-container>
</table>
Issue type
Issue description
Using TreeGrid, sometimes when I click the chevron icon (right arrow) this error appears:
ERROR TypeError: Cannot read property 'elementRef' of undefined at oa.getDataIndex (main-es2015.1d739b58e35289c1defe.js:1) at oa.toggleRow (main-es2015.1d739b58e35289c1defe.js:1) at oa.toggleCellRow (main-es2015.1d739b58e35289c1defe.js:1) at Oa.toggleRow (main-es2015.1d739b58e35289c1defe.js:1) at toggleRow (main-es2015.1d739b58e35289c1defe.js:1) at Object.handleEvent (1-es2015.1eb53515f8fbaee146a1.js:1) at Object.handleEvent (main-es2015.1d739b58e35289c1defe.js:1) at Object.handleEvent (main-es2015.1d739b58e35289c1defe.js:1) at Ei (main-es2015.1d739b58e35289c1defe.js:1) at main-es2015.1d739b58e35289c1defe.js:1
It does not occur when I click the item inside the grid. Just the arrow icon which was generated by the nb-tree-grid-row-toggle
NOTE: Data is being served by the server, not static.
Current behavior: Error shows sometimes. Mostly on first click.
Expected behavior:
Steps to reproduce:
Related code:
Other information:
npm, node, OS, Browser
Angular, Nebular