Re: Sorting an observableArray does not seem to work in Internet Explorer 10

171 views
Skip to first unread message
Message has been deleted

rpn

unread,
Apr 22, 2013, 9:05:39 AM4/22/13
to knock...@googlegroups.com, live...@gmail.com
Hello-
Technically, your sort function should return a number rather than a boolean.  Some browsers do work with a boolean, but I recall running into this issue once with Safari previously.  You could return something like Math.random() > Math.random() ? 1 : -1; or simply Math.random() - Math.random();


Hope that helps.




On Monday, April 22, 2013 7:43:56 AM UTC-5, live...@gmail.com wrote:
Calling observableArray.sort does not seem to do anything in Internet Explorer 10. I found this simple http://jsfiddle.net/RbX86/ that demonstrates the issue (at least on my system). The numbers are randomly sorted in Chrome but nothing happens in Internet Explorer 10 when the button is clicked.
 
Is this a bug in KnockoutJS or some strange issue on my system?
 

live...@gmail.com

unread,
Apr 22, 2013, 9:25:59 AM4/22/13
to knock...@googlegroups.com, live...@gmail.com
Hello-
Technically, your sort function should return a number rather than a boolean.  Some browsers do work with a boolean, but I recall running into this issue once with Safari previously.  You could return something like Math.random() > Math.random() ? 1 : -1; or simply Math.random() - Math.random();

 
 
Thanks for you reply.
 
I just discovered this myself. Apparently Chrome has this additional functionality for array sorting and I happended to stumble upon sample code that was based on this.
Reply all
Reply to author
Forward
0 new messages