Closed GoogleCodeExporter closed 8 years ago
Original comment by moo...@wwwendt.de
on 4 Feb 2011 at 9:16
This issue was closed by revision r462.
Original comment by moo...@wwwendt.de
on 5 Feb 2011 at 7:32
I am now getting a change in the tree in Safari. But the sorted children are by
no means in alphabetical order.
Question ... if I keep pressing the button that calls sortChildren, should I
expect the results to be different (e.g. reversed) or should it always sort
ascending alphabeticaly?
Original comment by oll...@gmail.com
on 6 Feb 2011 at 5:24
The default compare functions sorts by ascii, i.e. checks
if(string1 > string2)...
so small caps are sorted after upper case.
If you want to reverse or change the order, you can pass a custom compare
function to sortChildren()
Original comment by moo...@wwwendt.de
on 6 Feb 2011 at 7:41
Now in Chrome, I get no sorting results. I just see nothing happen in the tree.
In Safari, although the tree is changing, the results are not alphabetical.
Additionally, if I keep calling the sortChildren function on the tree, the
results just go back and forth from the original, to the incorrectly sorted
version. I am using titles like "b b" and "3) awesome" and "YOUTUBE" and
"ALRIGHT" and I am not getting desired results.
Original comment by oll...@gmail.com
on 7 Feb 2011 at 11:54
I tested this on safari and chrome
// Custom compare function (optional) that sorts case insensitive
var cmp = function(a, b) {
a = a.data.title.toLowerCase();
b = b.data.title.toLowerCase();
return a > b ? 1 : a < b ? -1 : 0;
};
node.sortChildren(cmp, false);
maybe you can post a link to your sample.
Original comment by moo...@wwwendt.de
on 8 Feb 2011 at 7:42
I recopied the latest version and it is all working great, THANKS! Before I
tried to take just the change you made and insert it into the minified version
and I messed up with the spacing. Most definitely fixed.
Original comment by oll...@gmail.com
on 8 Feb 2011 at 12:00
considered verified
Original comment by moo...@wwwendt.de
on 17 Jul 2012 at 4:16
Original comment by moo...@wwwendt.de
on 17 Jul 2012 at 4:19
Original issue reported on code.google.com by
oll...@gmail.com
on 3 Feb 2011 at 11:30