This repository has been archived by the owner on Jan 15, 2022. It is now read-only.
columnFormatters: assign a component to render a column's cells #333
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When Reactable is passed a data structure, we want to be able to designate a custom component to render inside each td of a particular column. This is based on a nice feature of react-bootstrap-table. This allows us to avoid using unsafeHTML and handle callbacks/interactivity cleanly.
This could have been handled in columns attribute, by adding an optional component property to each column object. But because of the way columns object disables column inference, this would require devs to build out the entire columns object even if only one column necessitated a component. (Personally, I think it would have been better to make developers filter columns out themselves--that is, keep column infererence but allow inferred columns to be overwritten by configuration in columns object.)
This PR assumes that passing data structure and using the components are mutually exclusive strategies.