Skip to content

Commit

Permalink
Merge pull request #98 from Holo-Host/feature/add-sorting-by-numbers-…
Browse files Browse the repository at this point in the history
…to-base-table

feat(base-table): add sorting by numbers
  • Loading branch information
mateuszRybczonek authored Jun 26, 2024
2 parents 116c039 + 820788b commit 52813cc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/BaseTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ const sortedItems = computed(() => {
: new Date(a[sortKey]).getTime() - new Date(b[sortKey]).getTime()
}
if (sortByType.value === 'number') {
return sortDirection.value === ESortDirections.desc
? Number(b[sortKey]) - Number(a[sortKey])
: Number(a[sortKey]) - Number(b[sortKey])
}
if (sortDirection.value === ESortDirections.desc) {
return a[sortKey] > b[sortKey] ? -1 : 1
} else {
Expand Down

0 comments on commit 52813cc

Please sign in to comment.