Skip to content

Commit

Permalink
Merge pull request #49 from tjhiggins/th_sort
Browse files Browse the repository at this point in the history
Change sorting to peak at row values.
  • Loading branch information
cmbankester authored Apr 10, 2017
2 parents f7108c8 + 38bfb02 commit 6ce5bd2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions knockout-datatable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class window.DataTable

if @sortField()? and @sortField() isnt ''
rows.sort (a,b) =>
aVal = ko.utils.unwrapObservable a[@sortField()]
bVal = ko.utils.unwrapObservable b[@sortField()]
aVal = ko.utils.peekObservable a[@sortField()]
bVal = ko.utils.peekObservable b[@sortField()]
if typeof aVal is 'string' then aVal = aVal.toLowerCase()
if typeof bVal is 'string' then bVal = bVal.toLowerCase()
if @sortDir() is 'asc'
Expand Down
4 changes: 2 additions & 2 deletions knockout-datatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
if ((_this.sortField() != null) && _this.sortField() !== '') {
rows.sort(function(a, b) {
var aVal, bVal;
aVal = ko.utils.unwrapObservable(a[_this.sortField()]);
bVal = ko.utils.unwrapObservable(b[_this.sortField()]);
aVal = ko.utils.peekObservable(a[_this.sortField()]);
bVal = ko.utils.peekObservable(b[_this.sortField()]);
if (typeof aVal === 'string') {
aVal = aVal.toLowerCase();
}
Expand Down
2 changes: 1 addition & 1 deletion knockout-datatable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6ce5bd2

Please sign in to comment.