question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sorting DESC on first column click instead of ASC

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:21
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
mrjamesrileycommented, Feb 23, 2018

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.

0reactions
pmacncommented, Feb 1, 2022

Would second this request but would need it to be on a column by column basis. Example use case, We have a table of items with string and number columns. We want to configure the string columns to sort ascending by default and the numbers to sort descending by default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

On Column Click, Order Descending by Default - DataTables
When sorting a column, the first click is always ascending order. two clicks are required to make the column show in descending order....
Read more >
jQuery dataTables : Clicking thead should sort descending ...
Open a none minified jquery.dataTables.js and search for DataTable.defaults. To reverse the default ordering for all columns, so it becomes desc ...
Read more >
Quick start: Sort data in an Excel worksheet - Microsoft Support
On the Data tab, in the Sort & Filter group, click Sort to display the Sort popup window. Sort command in the Sort...
Read more >
Data Grid - Sorting - MUI X
Custom sort order ... In practice, when you click a column that is not sorted, it will sort ascending ( asc ). The...
Read more >
DataTables order Option - GeeksforGeeks
value: This is a multi-dimension array value that specifies the rows and direction that the columns are to be sorted. The first value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found