Closed vkovalskiy closed 12 years ago
Hi @vkovalskiy, thanks for the issue! That sounds about right. How many arguments are used in the declaration of your sort function? comparator
was recently changed to use [].sort
directly instead of _.sortBy
. when declared with two parameters.
If you're interested, there is a discussion regarding this change going on in #1301 as well.
Thanks for info @braddunbar!
I am using one argument. The recent changes you mention are not in the 0.9.2 release, right? I'll monitor #1301 for the resolutions.
I suppose that one-argument sorting comparator by string
should be available. As you have pointed out it is very convenient to sort something based on style, kind, etc.
That's definitely interesting. If you can work up a reproducible test case and post to jsfiddle or similar I would love to see it.
@wookiehangover thanks! I do not have Windows at hands now so I'll check it out tomorrow and get back with results.
I'm going to close this one as "not reproducible" for the time being, but please comment here if you can reproduce this again and I'll reopen it.
Stumbled upon the same issue. It is actually 743 line. It uses JS sort instead of SortBy because comparator function has no arguments which I don't understand. Can't think of a decent workaround aswell. If using sortby it works fine. JS doesn't work probably because of IE8 Array sortings bugs: http://www.zachleat.com/web/array-sort/
This problem was because "comparator" function was binded to model, removed binding and it works OK.
@rsirotins coould you please elaborate more on how you have fixed the problem? thanks in advance.
@vkovalskiy Just stumbled upon the same error. You have to use ->
instead of =>
for the method defintion, then it works.
@gucki wow, thanks!
Environment: IE8
When creating a
comparator
function and returningstring
value from it IE throws exception saying:Number Expected
. The exception point shown by IE is backbone.js:723https://github.com/documentcloud/backbone/blob/master/backbone.js#L723
returning
int
from comparator makes IE happy