question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dataKey should allow for nested properties...

See original GitHub issue

We have a scenario where our row data is an object with nested properties, like so:

{
  "name": 'bob',
  "metaData": {
     "foo": 'x',
     "bar": {
        // ... more data ...
      },
     "baz": {
       "blah": false
     }
  }
}

In my table I want to display columns of information for all the data in my object, not just the top-level… also, because dataKey is used to uniquely identify a column to an object property, and because it does not allow nesting, I have to flatten my object and assign a different dataKey for every column…

It would be helpful if instead, I could provide a nested dataKey value and have react-virtualized parse my object accordingly…

Example:

<Column dataKey='name' ... />
<Column dataKey='metaData.foo' ... />
<Column dataKey='metaData.bar' ... />
<Column dataKey='metaData.baz.blah' ... />

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:19
  • Comments:5

github_iconTop GitHub Comments

5reactions
GuySerfatycommented, Jun 11, 2019

Another option can be: <Column label="Eye color" dataKey="someid" cellDataGetter={({rowData})=>rowData.nested.eyeColor} />

2reactions
ghostcommented, Feb 19, 2019

@AlexAichinger What we ended up doing is passing in a dataKey that does not map to anything specific, but is unique, and then using a switch statement in our renderer with the dataKey to determine which rowData property value to use… its not great, but it works…

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Mapping through array in React with nested objects
I want to have the _value for each object so that I can eventually load it into a area chart from rechart. The...
Read more >
how to use multiple Datakeys in Nested Gridview?? - MSDN
I think you can do like this: 1) Put a gridview into the outer GridView. In its Itemteplate put another Gridview with a...
Read more >
Exploring Recharts: different ways of accessing data
Passing data in dataKey helps with some level of customization to allow accessing data or nested data directly using object keys.
Read more >
Nested JSON to Table - Queries and Resources - Retool Forum
When I try it comes through as a table with names as the columns and one row of nested objects for each name....
Read more >
Data Keys - Ignition User Manual 7.9
Dynamic Data Keys allow you to use the value of a Data Key on a non-string property. With Dynamic Data Keys, you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found