Ngx-datatable: Sort doesn't work on the first click

Created on 4 Nov 2016  路  8Comments  路  Source: swimlane/ngx-datatable

I'm submitting a ... (check one with "x")

[ x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior
when click on column header at the very first time, the data in the table kinda moving around but not sort correctly.

after first click, everything works properly. (or not, sometime the first row is not really the first one like it should be.)

Expected behavior

should work at the first time

Reproduction of the problem

on demo page

Please tell us about your environment:
Win10/Chrome

  • **Table version: latest
  • Angular version: 2.0.x

Thank you for your great work !

Bug Moderate Investigate

All 8 comments

Thanks for the spot, I knew there is something weird with the sort. I had thought it was just slow responsiveness.

Fixed in latest release.

ah.... it is kinda broken again. Check it on demo page

When you click it, it doesn't sort correctly. The first one is off.

And the asc and desc are kinda weird too.

in the begining:
image

1st click , it shows sort-asc, but the first one is off.
image

2nd click, it shows sort-desc but the whole list is asc
image

3rd click, it shows sort-asc, but the whole list is desc
image

When I said sort asc/desc, I was referring to the code out put not icon.

Another interesting behavior is, if you try it on filter demo, sort it first and type something in the filter and the sorting will flip back to correct order.

yeah, I was looking at that line too. But I think it is correct, because it flips back to correct order, which indicates the sorting function works correctly.

@amcdnl I think you are correct. It appears that the setter is causing sortRows to be called a second time when the column header cell is clicked.

Fixed in 2.0

Was this page helpful?
0 / 5 - 0 ratings