How to render custom component in DataTable.Cell
See original GitHub issueI’m trying to create a table with a button in the last column. But, when I add something different than a text node I get this error:
Cannot add a child that doesn't have a YogaNode to a parent withou a measure function!
So, this is working:
<DataTable.Cell>Test</DataTable.Cell>
But this is not:
<DataTable.Cell children={<Button>Test</Button>} />
// neither this
<DataTable.Cell>
<Button>Test</Button>
</DataTable.Cell>
Am I doing something wrong?
Package | Version |
---|---|
react | 16.11.0 |
react-native | 0.62.2 |
react-native-paper | 3.10.1 |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
Column rendering - DataTables example
Each column has an optional rendering control called columns.render which can be used to process the content of each cell before the data...
Read more >lightning-datatable with custom cell and component mutates Id ...
What's happening is that you're assigning the value to this, so it gets modified during rendering. To fix this, use a different attribute...
Read more >Customizing the Lightning Datatable Component
You can implement a custom cell, such as a delete-a-row button or image. The lightning-datatable component supports both standard data types ...
Read more >react-table render component inside data - Stack Overflow
You're passing a react component to a data field that expects a string. Try customising your cell via Cell props:
Read more >Building a Data Table Component in React — Development
Add className=”Cell-fixed” to the first cell of each row. The component maps through each row (and not each column) so, for simplicity, we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
same issus +1 DataTable.Cell didn’t support children component yet. 3.10.1
but here is a solution :
You can use a
View
instead ofDataTable.Cell
. Here’s an example:EDIT: To make this look good, you need to add some styles too. If you want, you can replicate the style used by the DataTable.Cell.