Two tables on same page throwing error when sorting.
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here
Current behavior If I have two tables on the same page and try sort the second table, an error is thrown. I am defining a ngx-datatable-column as I want to use a cell template.
Expected behavior Both tables should be sortable.
Reproduction of the problem Plunker does not seem to be working?
To create it is very simple. All I did was create two tables in the same component as follows:
<ngx-datatable [rows]="table1" [rowHeight]="'auto'" [columnMode]="'flex'">
<ngx-datatable-column name="Customer" prop="customerNumber">
</ngx-datatable-column>
</ngx-datatable>
<ngx-datatable [rows]="table2" [rowHeight]="'auto'" [columnMode]="'flex'">
<ngx-datatable-column name="Customer" prop="customerNumber"></ngx-datatable-column>
</ngx-datatable>
This resulted in the following error when I click on the column header in the second table: EXCEPTION: Error in ./DataTableBodyComponent class DataTableBodyComponent - inline template:31:12 caused by: Expression has changed after it was checked. Previous value: ‘true’. Current value: ‘false’.
-
Table version: 6.0.0
-
Angular version: 2.3.1
-
Browser: Chrome
-
Language: TypeScript 2.1
Thanks, Kevin.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
Seeing the same issue as @ipassynk. It also occurs if subsets of the same row collection are used in multiple tables without being deep cloned. I forked the above plunkr to show an example of this case https://plnkr.co/edit/iDzItKhvp2QcfZBMMqH4?p=preview.
I don’t think it is related to the shared columns. It is related to the same row objects and in particular $index that is added to the grid. It would be nice to share the row objects and have custom $index for each grid. You can check the plunk https://plnkr.co/edit/i4ayUTOuYQnFgvqbIP2m that shows two grids with with different columns objects but the same rows. open the console and start clicking on sort. See the error.