Skip to content

Commit 91c46ed

Browse files
authored
Fix sort when using vuetify
Use sortDesc when using vuetify
1 parent b8fe303 commit 91c46ed

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

templates/vue-common/mixins/ListMixin.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,25 @@ export default {
3333

3434
methods: {
3535
onUpdateOptions(props) {
36-
const { page, itemsPerPage, sortBy, descending, totalItems } = props;
36+
const { page, itemsPerPage, sortBy, sortDesc, descending, totalItems } = props;
3737
let params = {
3838
...this.filters
3939
};
4040
if (itemsPerPage > 0) {
4141
params = { ...params, itemsPerPage, page };
4242
}
43+
44+
let sortDescVuetify = false;
45+
let vueDescending = descending;
46+
if (sortBy.length === 1 && sortDesc.length === 1) {
47+
if (sortDesc[0]) {
48+
sortDescVuetify = true;
49+
}
50+
vueDescending = sortDescVuetify;
51+
}
4352

4453
if (!isEmpty(sortBy)) {
45-
params[`order[${sortBy}]`] = descending ? 'desc' : 'asc';
54+
params[`order[${sortBy}]`] = vueDescending ? 'desc' : 'asc';
4655
}
4756

4857
this.getPage(params).then(() => {

0 commit comments

Comments
 (0)