Open rongxike opened 7 years ago
(function() { angular.module('app', ['ui.grid']) .controller('demoCtrl', ['$scope', function ($scope) { var data1 = [ {Name: 'Tom', Age: 'a', Location: 'Port Jeff', Sex: 'Male'}, {Name: 'Jen', Age: '', Location: 'Port Jeff', Sex: 'Female'}, {Name: 'Tom', Age: 'b', Location: 'Port Jeff', Sex: 'Male'}, {Name: 'Diana', Age: '', Location: 'Port Jeff', Sex: 'Female'} ]; $scope.data = new jinqJs() .from(data1) .orderBy([{field: 'Age', sort: 'desc'}]) .select('Name', 'Age', 'Sex'); }]); }());
result:
'a' '' 'b' ''
https://jsfiddle.net/rongxike/r7Lc22ta/
To fix this error:
orderByComplex = function (complexFields) { ... lValue = (field === null ? first : (isNaN(first[firstField]) || first[firstField] == '' ? first[firstField] : Number(first[firstField]))); rValue = (field === null ? second : (isNaN(second[secondField]) || second[secondField] == '' ? second[secondField] : Number(second[secondField]))); ... }
Thanks! I will run it through the unit tests.
I've added this fix and a regression test to my fork (https://github.com/mcoakley/jinqJs) in which I'm making the testing changes.
Great!
result:
https://jsfiddle.net/rongxike/r7Lc22ta/
To fix this error: