Sorting not working for column with custom cell and accessor #2586
-
I've just started using this plugin and am having difficulty getting the sorting to work for a particular column (it works OK on other columns within the same table). This column's content is based on some properties from the data in that row so I have created a custom Here's a link to the code in a Gist. I've looked over the code and it looks OK. The data it's displaying has about 55 rows. When I click the header to sort it does sort, but it seems to sort the rows in two separate batches, See here: What's more, if I change the column data so that it always print the same value:
The sorting again works, but it again groups the values rather than treating the entire set of rows as one. What am I doing wrong here? My understanding is that the PS. I read in the docs that if the accessor is set to a function that a unique ID needs to be provided. I used |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Looking deeper into this I'm seeing more strange behaviour. When I have a functional accessor, it appears to be grouping rows on the property name rather than the value within that property. For example:
When I sort this column, all rows that get their value from the I am either doing this completely wrong or there is a bug in the app, but this is so widely used that I'd be surprised if this wasn't found before. |
Beta Was this translation helpful? Give feedback.
-
I ended up abandoning this library in favour of react-data-table-component - not because of this issue specifically - but for any future readers, the issue here is that sorting is case sensitive by default. This is why it appeared to be splitting rows into two groups. |
Beta Was this translation helpful? Give feedback.
-
if case sensitive sorting is the concern then it can be customised...
|
Beta Was this translation helpful? Give feedback.
I ended up abandoning this library in favour of react-data-table-component - not because of this issue specifically - but for any future readers, the issue here is that sorting is case sensitive by default. This is why it appeared to be splitting rows into two groups.