How to update the accessorFn? #5216
Replies: 2 comments 2 replies
-
create a custom filter |
Beta Was this translation helpful? Give feedback.
-
This issue is also similar as discussed in #4868. I have found a workaround using My finding is that, as long as the provided const rows = React.useMemo(() => [...data], [data, options]); However for large tables, this may have performance impact, as mentioned in the docs
|
Beta Was this translation helpful? Give feedback.
-
I am creating a generic data table.
The table data is provided by the API as JSON, and all field types are strings.
The fields that should be treated as numbers are specified by the user, and if specified, I need to cast the value to a number in the accessorFn for sorting, so I am creating a function called makeColumns to dynamically generate columns.
The problem is that when the format options are changed, the value returned by info.getValue() in the cell callback is not updated.
After a little digging, it appears that the cell callback is called on re-rendering, but the updated accessorFn is not being executed at that time.
Is it possible to update the accessorFn after the table is mounted?
https://codesandbox.io/p/devbox/crazy-swirles-49k3tw?file=%2Fsrc%2Fmain.tsx%3A21%2C4
Beta Was this translation helpful? Give feedback.
All reactions