ngx-datatable: Default Sort Not Working / Not Documented.
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
Current behavior
Default Sorting does not work Expected behavior
Have a way to be able to define which column to sort by at the start.
Reproduction of the problem
http://plnkr.co/edit/TLx2vYlCTLsqcLwvWafd is broken, if you can provide me a different plnkr I will post a repro What is the motivation / use case for changing the behavior?
Please tell us about your environment:
- Table version: 0.7.x
- Angular version: 2.0.x
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
- Language: [all | TypeScript X.X | ES6/7 | ES5]
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (2 by maintainers)
Commits related to this issue
- Fix(sort): fix default sort not working (#475) — committed to swimlane/ngx-datatable by marjan-georgiev 7 years ago
- Fix(sort): fix default sort not working (#475) — committed to rsparrow/ngx-datatable by marjan-georgiev 7 years ago
According to the commit from @marjan-georgiev it looks like its done like this:
<ngx-datatable [sorts]="[{prop: 'name', dir: 'desc'}]">...@yaotzin68 rather than waiting I did the sort myself with the help of underscore:
This seems to be Fixed in 10.3.0. Thanks
I agree that this issue should be reopened. The workaround provided by @RicardoVaranda works fine if you’re doing everything client side, I however am handling limit on the server side via Postgres. For anyone else doing the same, I have been working around this by manually calling the changeSort method in my
ngOnInit()here is an example:list.html
list.component.ts
hope that helps others until this issue is fixed.
@marjan-georgiev this issue still seems to exist, as as @lopadk notes, the issue can be seen on the demo page for default sorting: http://swimlane.github.io/ngx-datatable/#default-sorting. Can this issue be re-opened?
Works for me (9.3)
Same here, when page is loaded sorting indicator is visible, but items are not sorted.