Knockout-Contrib / Knockout-Contrib/KoGrid
sorting - 0 value always at the bottom
- Dominant language
- JavaScript
- Stars
- 277
- Forks
- 124
- PR merge metrics
- No merged PRs in 30d
Description
According to what is in the comments in the unwrappedData.sort method, you are purposely putting null and undefined values at the bottom of the grid at all times, whether sorting ascending or descending. I believe this is a mistake as this will also make 0 value fields put to the bottom no matter which way you are sorting. Also, if I override the sorting function through sortFn, your default behaviour will always fire causing my function to not evaluate until there is a value that is not falsy.
It would be nice that if I want a custom sort function that it runs against all values (it should be up to me to know to test against null and undefined).
Also, I believe your documentation is wrong. It gives the Example: function(a,b){return a > b}, which I believe should be function(a,b){return a - b}
http://ericmbarnard.github.com/KoGrid/#/api
Please let me know if more information is needed. Also, please feel free to let me know if I'm doing it wrong.
Sincerely
Steve Buchok
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the unwrappedData.sort method and its sortFn handling, then review the sorting example in the KoGrid API documentation. Verify ascending and descending behavior for 0, null, and undefined values, and verify that custom sortFn calls receive all values. Done means the behavior and documentation example agree with the intended sorting contract.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100