我想按字母顺序过滤列,这是按大小过滤的代码怎么办谢谢
const columns = [{
title: 'First Name',
dataIndex: 'first_name',
sortDirections: ['descend', 'ascend'],
key: 'first_name',
width: '20%',
sorter: (a, b) => a.first_name.length - b.first_name.length,
}]
您可以使用 localeCompare()
sorter: (a, b) => a.first_name.localeCompare(b.first_name);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句