Open on3al opened 6 years ago
Thanks for raising this issue.
Is there any option to watch table is rendered so that we call ExpandAll event after load.
Or Any property to set by default expended or collapsible.
@dalbir
Any property to set by default expended or collapsible
I think so too.
I have the same issue. Need to subscribe to OnLoaded event to expand relevant rows. Any updates? Workarounds?
I'm having this same issue.
I also want the rows to start expanded by default. I had to workaround this issue using the code below. However, it runs the check about five times (which makes it tough to ever collapse the rows) and I'd appreciate this bug being fixed. (Note this is the Angular Universal version)
@ViewChild('myTable') tableRef: any;
...
ngAfterViewChecked() {
if (isPlatformBrowser(this.platformId) && this.rows.length > 0) {
this.tableRef.rowDetail.expandAllRows();
}
}
Are there any updates/solutions for this bug? I have used setTimeout function as a workaround, but this is really dirty:
@ViewChild(DatatableComponent) private table: DatatableComponent;
constructor(private cdRef: ChangeDetectorRef) {}
setTimeout(() => {
this.table.rowDetails.toggleExpandedRow(ROW);
this.cdRef.detectChanges();
}, 1000);
In reality this is an Angular bug. ngAfterViewInit does not do what it says it does in documentation.
I'm submitting a ... (check one with "x")
Current behavior Calling table.rowDetail.expandAllRows() or collapseAllRows() only works after the view is fully initialized (i.e calling from a button click).
When called from ngOnInit or ngAfterViewInit, calling exapndAllRows() does not do anything, the rows remain in collapsed state.
Expected behavior Calling exapndAllRows from in ngOnInit and certainly in ngAfterViewInit, should start the rows in an expanded state.
Reproduction of the problem Modify the demo project you have showing collapse/expand to call expand from ngInit to see behavior What is the motivation / use case for changing the behavior? In many cases, the preferred state is to have all rows expanded by default.
Please tell us about your environment: Windows 10, Angular 4.1, Typscript 2.4.2
Table version: 0.8.x Yes, using 10.1.0 still see issue
Angular version: 2.0.x Yes, using angular 4.3 still an issue.
Browser: [all ]
Language: [all | TypeScript X.X | ES6/7 | ES5] Typescript 2.4.2