Cell Background colors gets scrambled on sort or search #1295
-
I have set background colors using the formatter function shown below and when the table data is not disturbed, the colors are correct.
EDIT: I've tried to find a work-around and have briefly looked at event processing but am not sure which event(s) would be best to use and on which object. onSort, onRowsChanged, onPagination... etc. Any advice would be appreciated. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
SlickGrid doesn't keep the cell content in synch, it only keeps a cell and column index, if you change sort/filter/page then the style will remain on the current cell position because the styling is applied on the cell/column index. You need to include logic yourself to handle all of that whenever a filter/sort/page is triggered, that will require to recalculate and reapply styling accordingly, this kind of logic is demoed in Slickgrid-Universal Example 12 (typically that would be Example 30 in here but I think I forgot to copy back some of the logic that changed when I encountered similar issue in universal). |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response, I'll give this a try. |
Beta Was this translation helpful? Give feedback.
SlickGrid doesn't keep the cell content in synch, it only keeps a cell and column index, if you change sort/filter/page then the style will remain on the current cell position because the styling is applied on the cell/column index. You need to include logic yourself to handle all of that whenever a filter/sort/page is triggered, that will require to recalculate and reapply styling accordingly, this kind of logic is demoed in Slickgrid-Universal Example 12 (typically that would be Example 30 in here but I think I forgot to copy back some of the logic that changed when I encountered similar issue in universal).
https://github.com/ghiscoding/slickgrid-universal/blob/43f546cc93e1ebaffdc2dfd9…