ngx-datatable
ngx-datatable copied to clipboard
Sorting doesn't work on grouped rows
[ 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
Also I just discovered If I have class="striped" it doesn't work when grouping is on also. Could be a separate ticket?
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.
+1
Exactly same problem 8 months later. I personally solved it by doing a ngx-datable inside a ngx-datable. The first table is only one row with the sorting value and without header to keep the illusion.
Here is my code
https://codepen.io/SBackUp/pen/MzpzEv
Still a problem with grouped sorting. doesn't work.
Still a problem with grouped sorting. doesn't work. Even the current demo has sort and doesn't work, this lib is actually abandoned, dont know why they dont make it explicit.
+1