Open howard-repos opened 4 years ago
Translation of this issue:
2.13.0
Win10/chrome
2.6.11
https://codepen.io/kabike/pen/jOPxBpJ?editors=1010
Click the sorting of "name" column
Null data should be adjacent when sorting
Null data is not adjacent when sorting
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
相同问题
I get this error with null values, if sorted in descending order it seems to work half way by placing the null value at the beginning of the rows when it should be at the end of the rows:
When trying to sort in ascending order, the sorting fails, the null value should be at the beginning of the rows:
I was able to apply a partial correction by handling the records that go into the data
table, adding an additional column with the prefix of SORT_
:
const recordsList = records.map((record, rowIndex) => {
// TODO: Test peformance.
Object.keys(record).forEach(key => {
const currentValue = record[key]
// Add column with sort values to correct sorting
let sortValue = ''
if (currentValue !== null && currentValue !== undefined) {
sortValue = currentValue.toLowerCase()
}
record['SORT_' + key] = sortValue
})
return {
...record
}
})
And in the-column
place the sort-by
property (SORT_
+ key) of the new column added to the records.
Element UI version
2.13.0
OS/Browsers version
win10/chrome
Vue version
2.6.11
Reproduction Link
https://codepen.io/kabike/pen/jOPxBpJ?editors=1010
Steps to reproduce
点击“姓名”列的排序
What is Expected?
null的数据在排序时应该相邻
What is actually happening?
null的数据在排序时不相邻