I'm having JSON object
var x=[{@Name:'test 1',@Sort:'1',@Status:'yes'},
{@Name:'test 2',@Sort:'5',@Status:'yes'},
{@Name:'test 3',@Sort:'4',@Status:'no'},
{@Name:'test 5',@Sort:'2',@Status:'no'}]
I'm trying to sort the obj by @Sort,@Name and @Status.
var orderBy="@Sort";
x.sort(_sortObj(orderBy));
function _sortObj(orderBy){
return function(a,b){
return (a[orderBy]<b[orderBy])?1:0....etc
}
}
It works fine in Firefox and Chrome...
But throws error in IE 7/8 as "number expected" on line
x.sort(_sortObj(orderBy));
I'm not sure what's going on and it will be great if anyone sort this out properly.