I'm submitting a ... (check one with "x")
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter
Current behavior
The current sorting behavior is working ASC on the first click and there is not any property to specify the the default sorting direction on the first click.
Expected behavior
It would be great to have a property, lets say 'sortingDirectionAtFirst', where we could change the sorting direcction on the first click. currently the datatable is working very well, but there is not any way to change the direccion on the first click to DESC for all the columns.
<ngx-datatable
class="material"
[rows]="reportData"
[sortingDirectionAtFirst]="DESC">
</ngx-datatable>
What is the motivation / use case for changing the behavior?
It would be nice to have the ability to change the sorting direction at the first click.
Please tell us about your environment:
Table version: 10.2.3
Angular version: 4.0.0
Browser: All
Language: TypeScript 2.4.2
Thank you
@maustand what about the direction of subsequent sorts sorting direction at first click? Example of that would be to sort by last name, then by first, then by middle. But someone might want the sort direction different for each header cell clicked, or depending on the specific context. It might be easier to get a callback when header cell is clicked and you can decide for yourself the direction.
Chiming that I would find this feature very useful
Totally behind this idea - in almost every case, for our use cases, the first click would want to be descending, as opposed to ascending. Having this controllable as an option per column would be awesome.
I would also find this very useful. It would be nice to have the option to choose the order of the initial sort order.
+1
Use this [sorts]="[{prop: 'name', dir: 'asc'}]" it will set sort direction to ascending order. when you click on column for the first time it will sort in desc direction
Use this [sorts]="[{prop: 'name', dir: 'asc'}]" it will set sort direction to ascending order. when you click on column for the first time it will sort in desc direction
It will make this column sorted by default when the table is rendered
I would find this very useful too.
Is there any known workaround for this one?
Most helpful comment
Totally behind this idea - in almost every case, for our use cases, the first click would want to be descending, as opposed to ascending. Having this controllable as an option per column would be awesome.