Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort doesn't work on the first click #254

Closed
maxisam opened this issue Nov 4, 2016 · 8 comments
Closed

Sort doesn't work on the first click #254

maxisam opened this issue Nov 4, 2016 · 8 comments

Comments

@maxisam
Copy link

maxisam commented Nov 4, 2016

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 !

@colinfang
Copy link

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

@amcdnl
Copy link
Contributor

amcdnl commented Nov 15, 2016

Fixed in latest release.

@amcdnl amcdnl closed this as completed Nov 15, 2016
@maxisam
Copy link
Author

maxisam commented Nov 22, 2016

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.

@maxisam
Copy link
Author

maxisam commented Nov 22, 2016

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.

@amcdnl
Copy link
Contributor

amcdnl commented Nov 22, 2016

Might be related to https://github.com/swimlane/angular2-data-table/blob/master/src/components/datatable.component.ts#L96 ...

@maxisam
Copy link
Author

maxisam commented Nov 22, 2016

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.

@scottmizo
Copy link

@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.

@amcdnl
Copy link
Contributor

amcdnl commented Dec 1, 2016

Fixed in 2.0

@amcdnl amcdnl closed this as completed Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants