Is there a way to set sort order in q-table as desc,asc,no sort ?
-
Is there a way to set sort order in q-table as desc,asc,no sort ? I see the default order as no sort,asc,desc but i want the opposite way due to type of data i use where i am more interested about bigger value at top and wanted to skip 2 clicks to get them??
-
@lakshmi set
pagination: { descending: true, ... }
then in QTable<q-table ... pagination.sync="pagination" ... />
. https://quasar.dev/vue-components/table#QTable-API Props -> Pagination ->pagination
. -
@metalsadman thanks a lot for quick response… i am using the same for pagination but the behaviour seems to be the same
1.no sort
2.ascending
3.descending -
what did you set your pagination object? here an example https://codepen.io/metalsadman/pen/LwWebB?editors=1011
-
I’ve solved this by replacing the icon of the column from upward to downward and then reverse the direction of sorting
{{col.label}}<q-icon :class="props.cols[10].__iconClass" name="arrow_downward" /></div> ... sorting(data, sortBy, descending){ ... const dir = descending ? 1 : -1 //opposite logic ... }