Be able to set initial sort direction per column

We have two columns in or table that we can sort on and we have set the default order to the second column desc. Whenever we change the sort column by clicking on the column header we want the data to be sorted desc now the default seems to be asc.

So the question is how can we set the initial order direction per column?

Hey @Robert_Sanders,

You can use the Interaction Section of your table setting to define defaut sorts:

image

Is this what you're looking for?

Hey @Robert_Sanders ,
I understand your question, you have to create a javascript query. When initially the data whenever query loads, in success run that javascript query then the data will come in descending order then by use of table sorting the functionality works and default data will come in descending again.

If you have more questions fell free to ask.

1 Like

Hey, no that not what I meant. This is UI thing. When you click on the header of a sortable column I want the default to be descending and not ascending.

So suppose I have two sortable colums timestamp and priority. When the page is first loaded the data is sorted on timestamp in descending order. Than when i click on the priority column header I want the data to be sorted in descending order so that the rows with highest priority are at the top. Currently this is not working because the default is apparently ascending. I can change the sort direction by using the sort change event but than the associated query is execute twice and that is not what i want.

Hey @Robert_Sanders,

Thanks for the request. It doesn't look like we have a setting for this, but I made a feature request internally. I will let you know if this feature ships.

Out of curiosity, are you referencing the sort array in your query? Are you using pagination?

2 Likes

Yes, this is what I'm trying to achieve now by making the first click sorts by descending instead of ascending