Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable0.6] fix(sorting): handle NaN results if the values are empty #757

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export default class SelectionColumn extends AbstractSelectionColumn {
sort(mode) {
const factor = mode === 'DESC' ? -1 : 1
return (rowA, rowB) => {
const selectionIdA = parseInt(rowA.data.find(item => item.columnId === this.id)?.value ?? null)
const vA = selectionIdA !== null ? this.selectionOptions.find(item => item.id === selectionIdA)?.label : ''
const selectionIdA = parseInt(rowA.data.find(item => item.columnId === this.id)?.value)
const vA = Number.isNaN(selectionIdA) ? '' : this.selectionOptions.find(item => item.id === selectionIdA)?.label
const valueA = this.removeEmoji(vA).trim()
const selectionIdB = parseInt(rowB.data.find(item => item.columnId === this.id)?.value ?? null)
const vB = selectionIdB !== null ? this.selectionOptions.find(item => item.id === selectionIdB)?.label : ''
const vB = Number.isNaN(selectionIdB) ? '' : this.selectionOptions.find(item => item.id === selectionIdB)?.label
const valueB = this.removeEmoji(vB).trim()
return ((valueA < valueB) ? -1 : (valueA > valueB) ? 1 : 0) * factor
}
Expand Down
Loading