react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Select child object as key on columns

Open aindong opened this issue 10 years ago • 2 comments

Hello I've the follow object [ { id: 1, email: [email protected], profile: { first_name: test } } ]

how will I be able to get the first_name on profile and assign it to keys? Thank you so much

aindong avatar May 20 '16 16:05 aindong

You would need a custom formatter for that, if I think that is what you mean

var ProfileFormatter = React.createClass({
  render:function(){
    var profile = this.props.value;
    return (
      <div>{profile.firstName}
      </div>);
    }
  });

The you assign the formatter to the profile column in the column specifcations column.formatter = ProfileFormatter

malonecj avatar May 23 '16 13:05 malonecj

@malonecj or anyone, using the above solution to nested object properties, is there a way to sort my columns using the column's formatter key? Mentioned at #889

jcarva avatar Jul 28 '17 22:07 jcarva