Open FrancescoBorzi opened 7 years ago
@ShinDarth the table is using OnPush change detection now. Have you tried passing a copy of the selectedRows
every time it changes? An easy way of doing that is to use the spread operator upon making the change. Example:
<ngx-datatable
...
[selectedRows]="selectedRows">
<ngx-datatable>
...
...
export class demo {
selectedRows: any[];
...
...
addRowToSelection(row: any) {
...
this.selectedRows.push(row); // Example of how you might make a change that won't be detected with OnPush
...
this.selectedRows = [...this.selectedRows]; // However you updated the rows, use this to make a copy
}
}
yes I saw that, I'm just saying that it would be better if there was a way to do it automatically
@ShinDarth Doing change detection on an unbounded very large array can be quite expensive. If you were to want something automatic, and performant, then you would have to shift the burden to the collection to notify the table. I am working on a fork of the project that allows an observable collection to be passed to the table, and it will subscribe to any changes, then all changes would be made to that special collection object from your perspective.
I don't see a future for allowing a regular array to make any change and have it automatically detected in the table.
Hi, I do have an issue with selected checkbox count update. The count is getting updated after some action like scroll up and scroll down. Is there any fix for this please ??
I'm submitting a ... (check one with "x")
Current behavior
[selected]="selectedRows"
does not update the selectedRows array when new rows are selectedExpected behavior it would be nice if it does