bencripps / react-redux-grid

A React Grid/Tree Component written in the Redux Pattern
http://react-redux-grid.herokuapp.com/
MIT License
446 stars 63 forks source link

Nested object property as column value #215

Closed mgscreativa closed 5 years ago

mgscreativa commented 5 years ago

Hi! sorry to bother. Do your component support displaying values of a nested object property?

I have this object

const Act = 
{
    "_id" : "vdenftDD8gxn2ZgRe",
    "userId" : "AdebgC6dXLE4aqLGg",
    "routine" : {
        "_id" : "G9nw8Bo3hgQnnTyAp",
        "name" : "Routine Name",
    },
    "createdAt" : "2018-05-03T01:36:09.694Z"
}

And I need to have a column populated with Act.routine.name, is that possible?

Thanks!

bencripps commented 5 years ago

You should be able to acheive this by adding a renderer property to your column:

name: 'act',
renderer: ({ column, value, row }) => (
    <span> Name: { value.routine.name } </span>
)
mgscreativa commented 5 years ago

Cooool! thanks a lot!