【发布时间】:2018-04-25 09:24:47
【问题描述】:
我正在使用React ant design table。
在该表中,我尝试使用 localeCompare 对空值进行排序,它显示类型错误。
JSON
const data = [{
key: '1',
name: null,
age: 32,
}, {
key: '2',
name: 'Jim Green',
age: '32',
}, {
key: '3',
name: 'Joe Black',
age: 32,
}];
当我排序时,我收到如下错误:
TypeError: Cannot read property 'localeCompare' of null
我在Code sand box上有完整的代码
【问题讨论】:
标签: javascript reactjs sorting antd