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 behavior and headers styling

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 Feature request 1: When sorting by multiple columns the datatable keeps the order in which the sort columns where selected. I mean lets suppose I have 4 columns in this order: name | lastname | ssn | dob. If I press dob and then lastname, the sort will be done first by dob then by lastname. This becomes even weirder when the table is by default sorted by several columns and the user changes the sort of one of them, the result is quite unpredictable for the end user.

Feature request 2: When there is no sort criteria applied to a sortable column there is no icon displayed that indicates that the column is sortable.

Expected behavior Feature request 1: Usually people reads the tables from left to right, so in my opinion it would have sense to sort the table in the order columns are displayed for instance lastname, dob. An option to perform this at this moment is to use external sorting, that’s what i did.

Feature request 2: The proposal is to use a style like .datatable-icon-expand:before i mean the glyph content “\63” of the font-family: “data-table”. When the column is not sortable ( sortable: false in the column config ) then that style shall not be displayed.

Reproduction of the problem Check your sort examples they behave like explained.

What is the motivation / use case for changing the behavior? Improving usability

Please tell us about your environment: Windows 7-10

  • Table version: 0.8.x “@swimlane/ngx-datatable”: “9.3.0”

  • Angular version: 4.0.0 This has nothing to do with angular.

  • Browser: IE11, Chrome, Firefox ( is a browser independent feature )

  • Language: TypeScript ( is a language independent feature )

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:12

github_iconTop GitHub Comments

7reactions
kitloongcommented, Jan 8, 2018

@ochebotar Try this, works for me .sort-btn:not([class*="datatable-icon-"]):before { font-family: data-table; content: "c"; }

6reactions
jcphluxcommented, Sep 17, 2017

I have created a plunker that does all the needed styles for the headers. The last column in the example is not sortable to demo that it will not show the arrows on non-sortable columns. I have created the styles below that will only show on headers that have the sortable class.

.sortable .sort-btn:after { font-family: data-table; content: “c”; } .sortable .sort-btn.datatable-icon-down:after { content: “f”; } .sortable .sort-btn.datatable-icon-up:after { content: “e”; }

In any column that I don’t want sorting I add the input of sortable: false

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sort header | Angular Material
To add sorting behavior and styling to a set of table headers, add the <mat-sort-header> component to each header and provide an id...
Read more >
Angular Material: equal styling for mat-sort-headers and non ...
Adding mat-sort-header="" (empty) to my Acties HTML, but then it'll mess with sorting, and sort on Acties instead which is not possible, but...
Read more >
Column Header: Styling & Appearance Feature of our Datagrid
Header Templates ; In case of sorting ascending the data in the column, this shows the associated icon. · In case of sorting...
Read more >
Angular Material Sort Header - Javatpoint
Adding sorting behavior and styling a set of table headers adds the <mat-sort-header> component to every heading and provides an ID that will...
Read more >
Change Sort Order Using Column Headers - Oracle Help Center
Click the header of the column you want to sort by. The report is sorted by the column you select in ascending order,...
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