Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

antd 中的表格table 排序,sort返回为1,表格没反应,是怎么回事?

image
handleSorter函数方法
`

handleSorter(a, b) {
    let dingdan = this.formRef.current.getFieldsValue()['dingdan'];
    let rowData1 = dingdan[`table_row_${parseInt(a.key)}`]['table_type'];
    let rowData2 = dingdan[`table_row_${parseInt(b.key)}`]['table_type'];
    console.log(rowData1);
    console.log(rowData2)
    console.log('排序结果')
    console.log(rowData2.localeCompare(rowData1, 'zh-CN'));
    // return 1;
    return rowData2.localeCompare(rowData1, 'zh-CN');

`
结果返回为-1或者1, 表格都没有反应
rowData1和rowData2是排序列的type(是中文的)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

返回了之后呢,对数组操作了吗,更新视图了吗


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...