ChangeDetectionStrategy.onPush not allowing rowClass to update
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, post on Stackoverflow or Gitter
Current behavior
In my use-case for this component, I’m using the datatable as a list, in which clicks on rows open a side-panel. Once a row is clicked, its colour changes as long as the side-panel is open. This is achieved by altering a boolean field in the object associated with the row, namely “$$activated”, and using the rowClass input to assign a CSS class to the entire row.
Moreover, while the side-panel is open, the user can change the activated row by using the arrow keys, and this will in turn change the $$activated field on the previous/next item allowing to navigate the table. Finally, once the side-panel is closed, the row will lose its activated style.
This used to work perfectly until, relatively recently, the onPush change detection strategy has been added: what happens now is that, when the panel is open and I navigate the table, the datatable component won’t realise that data has changed and therefore the glowing row won’t change. Also, once I close the side-panel, the row will remain activated up until I hover the table with my mouse, which triggers a recalculation of the row styles (including mine defined through rowClass).
Expected behavior I would expect the datatable to detect my changes. This might be achieved by making the ChangeDetectionStrategy configurable.
Please tell us about your environment: Mac OS X
- Table version: 11.2.0
- Angular version: 5.2.8
- Browser: Google Chrome 65.0.3325.162
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:6
Top GitHub Comments
Figured out the solution for #1334:
@evxn thank you so much…it working