【发布时间】:2019-11-04 09:41:34
【问题描述】:
React-table 是这样对小数进行排序的:
我的猜测是,虽然我从服务器接收数字,但 react-table 将它们作为文本处理。所以,我像这样修改了访问器:
accessor: d => Number(d.Invoice_Weight).toFixed(2)
但我总是弄错排序。
这是列的代码:
{
Header: () =>
<DropDownMenu
header={content[lang].Invoice_Weight}
openModal = {this.onOpenSelectColumnsModal}
/>,
id: 'Invoice_Weight',
sortable: true,
accessor: d => Number(d.Invoice_Weight).toFixed(2),
//width: 200,
getProps: () => {
return {
style: {
textAlign: 'right'
}
}
},
show: Invoice_Weight,
},
【问题讨论】:
标签: reactjs react-table