state = {
sortedInfo:{
columnKey:'默认排序的项',
order: 'ascend'
},//默认排序
}
column = [
{
title: "默认排序的项",
dataIndex: '默认排序的项',
key: '默认排序的项',
sortOrder: this.state.sortedInfo.columnKey === '默认排序的项' && this.state.sortedInfo.order,
},
]
//handleChange 是table 的 onChange 事件
handleChange = (pagination, filters, sorter) => {
this.setState({
sortedInfo: {
columnKe:sorter.columnKey,
order:sorter.order
},
});
let columns = this.columns;
for(let i = 0;i < columns.length ;i++){
if(columns[i].dataIndex == '默认排序的项'){
delete columns[i].sortOrder
break;
}
}
}
antDesign table 默认排序 ,解决defaultSortOrder不生效(antDesign 3.X)
最新推荐文章于 2024-09-20 15:54:31 发布