Skip to content

Commit f3e0b7a

Browse files
committed
Add must-sort prop
1 parent 7b89457 commit f3e0b7a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/components/DataTable.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ const props = defineProps({
405405
type: Boolean,
406406
default: false,
407407
},
408+
mustSort: {
409+
type: Boolean,
410+
default: false,
411+
},
408412
});
409413
410414
// style related computed variables
@@ -719,7 +723,7 @@ const updateSortField = (newSortBy: string, oldSortType: SortType | 'none') => {
719723
} else if (oldSortType === 'asc') {
720724
newSortType = 'desc';
721725
} else {
722-
newSortType = null;
726+
newSortType = (props.mustSort) ? 'asc' : null;
723727
}
724728
725729
if (serverOptionsComputed.value) {

src/modes/Client.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
:header-item-class-name="headerItemClassNameFunction"
7070
:body-item-class-name="bodyItemClassNameFunction"
7171
border-cell
72+
must-sort
7273
>
7374
<template #expand="item">
7475
<div style="padding: 15px">

0 commit comments

Comments
 (0)