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 doesn't work on grouped rows

See original GitHub issue

[ X] bug report => search github for a similar issue or PR before submitting [ ] feature request [ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter


**Current behavior**
When selecting a column to sort on a grouped table nothing happens
ie. in demo page http://swimlane.github.io/ngx-datatable/#
Gender (sort desc) -> data doesn't change
Gender (sort asc) -> data doesn't change

**Expected behavior**
When selecting a column to sort on data inside group sorted
ie. in demo page http://swimlane.github.io/ngx-datatable/#
Gender (sort desc) -> data in group should be ordered Female, Female, Male, Male,
Gender (sort asc) -> data doesn't change Male, Male, Female, Female


**Reproduction of the problem**
click on column sorting observe data in group

**What is the motivation / use case for changing the behavior?**
sorting consistency and expected behavior

**Please tell us about your environment:**
N/A

* **Table version:** 0.8.x
N/A

* **Angular version:** 2.0.x
N/A

* **Browser:** 
Chrome

* **Language:**
all

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:10
  • Comments:7

github_iconTop GitHub Comments

6reactions
PurePropcommented, Nov 27, 2018

Still a problem with grouped sorting. doesn’t work.

1reaction
Phyrracommented, May 25, 2018

You can react to the (sort) event on the table and sort the grouped entries yourself.

BUT

For some reason, the sorting is not always using the order that is put in. If the input values for [rows] and [groupedRows] change (due to some filtering), some positions of rows seem to be cached and they are placed seemingly at random.

For example:

  • Order the elements ascendingly (by number), you get -1, 0, 1, 2
  • Filter elements that are >= 0, update [rows] and [groupedRows], change the sorting - the elements have order 2, 1, 0 but they are rendered in order of 1, 0, 2

It’s often the first row that gets moved to the bottom, not always though. I haven’t figured out a clear “rule” or reason behind this mismatch of element-order and render-order.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sort grouped rows in excel - Microsoft Community
If you want to group rows in a sort you have to use a helper column which defines which row belongs to which...
Read more >
How do I group rows in a spreadsheet and keep them together ...
First sort your data in descending order so that the item row is below the ingredients that belong to it. Group your ingredient...
Read more >
Sub-groups not sorting with grouped row - Mr. Excel
I have been doing that and some groups move with the assigned groups and some don't. The majority of the time the grouped/collapsed...
Read more >
How to Sort in Excel Rows or Columns Avoid Sort Problems
If there is a blank row or blank column in the data, part of the data might be sorted, while other data is...
Read more >
How to sort grouped rows and columns? - Google Support
Select columns A through D. Then menu Data => Sort Range, column A is preselected. Add another sort column. B is preselected. Choose...
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