hyojin / material-ui-datatables

An another React Data tables component.
MIT License
165 stars 58 forks source link

how to custom data row when render? #12

Open thearabbit opened 7 years ago

thearabbit commented 7 years ago

I base on Meteor JS + Mongodb. I get the data from Mongodb, and then attache it to data={TABLE_DATA} directly. But I would like to formate any data field, example: createdDate Field: "DD/MM/YYYY". Please example.

ghost commented 7 years ago

@thearabbit

{
  key: 'name',
  label: 'Dessert (100g serving)',
  sortable: true,
  tooltip: 'Dessert (100g serving)',
  className: 'important-column',
  style: {
    width: 250,
  },
  render: (name, all) => <p>{name}</p>
}

Based on this - https://github.com/hyojin/material-ui-datatables/pull/39/commits/5b4d613fab39408620fcc9b40466621641d3553a

... { key: 'enabled', render: (column, row) => ({column ? column.toString() : 'false'}) }, ...