[英]Nested Json in Table - React-Virtualized
I'm using Table from 'react-virtualized'. 我正在使用来自“反应虚拟化”的表格。
I receive some nested data that I want to display inside my custom Row. 我收到一些嵌套数据,这些数据要显示在自定义行中。 My problem is to bind nested json to my Column dataKey.
我的问题是将嵌套的json绑定到我的Column dataKey。
data=
{
name:'Chris',
age:'15',
adresse : {
number:'14',
street: 'xxx'
}
}
My Column 我的专栏
<Column dataKey="name" [....] />
<Column dataKey="age" [...] />
<Column dataKey=" ??????" /> // adresse.number ?
Thanks 谢谢
Just supply a cellDataGetter
value for the 3rd column. 只需为第三列提供一个
cellDataGetter
值。
If you only have the 1 field it could be like: 如果只有1字段,则可能是这样的:
<Column
cellDataGetter={({ rowData }) => rowData.address.number}
dataKey="adresse"
/>
If you want to display more than one it could be more like: 如果要显示多个,则可能更像:
<Column
cellDataGetter={({ dataKey , rowData }) => rowData.address[dataKey]}
dataKey="number"
/>
<Column
cellDataGetter={({ dataKey , rowData }) => rowData.address[dataKey]}
dataKey="street"
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.