hyojin / material-ui-datatables

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

Boolean type field results data not rendered. #61

Open logysis opened 7 years ago

logysis commented 7 years ago

I have an array of users. "enabled" field can not be rendered, and console show this error: warning.js:36 Warning: Failed prop type: Invalid prop children supplied to DataTablesRowColumn, expected a ReactNode. in DataTablesRowColumn (created by DataTables) in DataTables..............

const Users = [ { id: newGuid(), userName: "MasterUser", userType: UserTypes.MASTER, timeZone: "", email: "xxx@xxx.com", enabled: true, test: true, permissions: getUserPermission(UserTypes.MASTER) } ]

hyojin commented 7 years ago

@logysis Hi, What are you going to display with "enabled" field? If it is "true" or "false" as string, then you can convert it to string before render or can use custom render function in your column settings. for example,

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