Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
praveenk1029 opened this issue Sep 9, 2021 · 0 comments
Open

Comments

@praveenk1029
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant