AllenFang / AllenFang/react-bootstrap-table

React Bootstrap Table - Iterate over an array of Objects for Datafield

未关闭
#2,136 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
2.2k
派生
761
PR 合并指标
30 天内没有已合并 PR

描述

This is a duplicate thread on the same issue which was not resolved.
https://stackoverflow.com/questions/64211929/react-bootstrap-table-iterate-over-an-array-of-objects-for-datafield

// This works only for the first item in the Array.
{
dataField: `object.arrayOfObjects.[0].propertyInEachObject.length`,
sort: true,
text: 'Datasets',
headerStyle: () => ({ width: COL_WIDTH.STANDARD }),
},

How can I make it work or all of them? I tried a regex solution but I am not good at them. Can someone help me, please? I looked at the Docs, but that property dataField takes a string, so I cannot assign a function to it.

Here is an example object, I am dealing with. And the result I am looking for is 5. The length of the 2 property arrays.

{
"object": {
"arrayOgObjects" : [
{
"property1": ["One", "Two"]
},
{
"property1": ["One", "Two", "Three"]
}
]
}
}
I see only object-object but not object-list mapping in the docs - dataField: 'address.postal'
Could someone please help me with this as I got stuck here for hours?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。