Skip to content

Commit

Permalink
fix: sorting now works without providing an initial direction
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodressel authored and mmpetarpeshev committed Jun 25, 2024
1 parent 88542ba commit 738880a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/explore/BaseTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default {
},
initialSortDirection: {
type: String,
default: null,
default: 'desc',
},
},
data() {
Expand All @@ -115,6 +115,7 @@ export default {
rowsSorted() {
if (!this.sortBy) return this.rows;
return this.rows.slice().sort((a, b) => {
if (!this.sortBy || !this.sortDirection) return 0;
const aValue = this.tryParseInt(a[this.sortBy].value);
const bValue = this.tryParseInt(b[this.sortBy].value);
if (aValue < bValue) return this.sortDirection === 'asc' ? -1 : 1;
Expand Down

0 comments on commit 738880a

Please sign in to comment.