I am using v-for to display a list of surgeries. How would I change the sort order to descending in this?
v-for="previousSurgery, index in _.sortBy(model.previousSurgeries, ['dateAsNumber', 'previousSurgery'])"
I am using v-for to display a list of surgeries. How would I change the sort order to descending in this?
v-for="previousSurgery, index in _.sortBy(model.previousSurgeries, ['dateAsNumber', 'previousSurgery'])"
Great question:
Sorting or better “ordering” is bettere handled with lodash’s orderBy
function as documented here:
https://lodash.com/docs/4.17.15#orderBy
// ordering code for date newest first and ascending order#:
_.orderBy(model.previousSurgeries, ['dateAsNumber', 'previousSurgery'], ['desc', 'asc'])