尝试将onClick功能添加到React-Table行时出错

时间:2018-09-05 14:31:06

标签: javascript reactjs html-table react-bootstrap react-table

我试图在我的React-Table中添加行选择功能,但发现这样做相当困难。我正在使用此解决方案=> Select row on click react-table,但无法使其正常工作。我收到此错误:

TypeError:无法读取未定义的属性'className'

根据我在网上找到的信息,这似乎与我的数据格式有关,因此,如果这似乎是问题,我也可以发布它:

const columns = [{
  Header: 'Station ID',
  accessor: 'stationId'
}, {
  Header: 'DCP#',
  accessor: 'dcp'
}, {
  Header: 'Sensor',
  accessor: 'sensor'
}, {
  id: 'startDate',
  Header: 'Start Date/Time',
  accessor: d => d.startDate.valueOf(),
  Cell: props => <span className='startDate-table-col'>{moment(props.value).format('l') + ' ' + moment(props.value).format('LT')}</span>
}, {
  id: 'endDate',
  Header: 'End Date/Time',
  accessor: d => d.startDate.valueOf(),
  Cell: props => <span className='endDate-table-col'>{moment(props.value).format('l') + ' ' + moment(props.value).format('LT')}</span>
}
]

任何帮助都会很棒。非常感谢。

0 个答案:

没有答案
相关问题