Re: [jQuery] Sorting items in jQuery pseudo-array

2007-03-27 Thread Chinmay Kulkarni
Eric, Right as always. Had to add some sprucing code to the html() returned. Some values gave a NaN when parseInt-ed. Thanks again for the help. Liking jQuery more by the day! Regards, Chinmay Erik Beeson wrote: > > Completely random sorting usually means there's something wrong with > your

Re: [jQuery] Sorting items in jQuery pseudo-array

2007-03-27 Thread Erik Beeson
Completely random sorting usually means there's something wrong with your comparing function. Try adding some debugging output in your comparing function and make sure you're comparing the correct values and get the expected result there. If you actually have null values in that first if statement

Re: [jQuery] Sorting items in jQuery pseudo-array

2007-03-27 Thread Chinmay Kulkarni
I tried using the code, as suggested by Eric, but it doesn't work. In my case, I'm trying to sort a bunch of divs based on the value of a span inside each. However, the sorting is completely random! I don't know what I'm doing wrong! jQuery.noConflict(); $j = jQuery; riggit = { /*...*/

Re: [jQuery] Sorting items in jQuery pseudo-array

2007-03-27 Thread Chinmay Kulkarni
Eric, I need to implement a simliar funcnality, and was looking at the trac. What throws me offis that thetatus of the Bug was set to 'review' a few hours ago. Any *more* magical way to do this coming up? Erik Beeson wrote: > > Even easier than that: > > jQuery.fn.sort = function() { > re

Re: [jQuery] Sorting items in jQuery pseudo-array

2007-03-26 Thread Bruce McKenzie
Thanks Eric. Erik Beeson said the following on 3/26/2007 9:47 AM: > Even easier than that: > > jQuery.fn.sort = function() { > return this.pushStack( jQuery.makeArray( [].sort.apply( this, > arguments )) ); > }; > > See here: http://dev.jquery.com/ticket/255 > > Looks like I'm still about t

Re: [jQuery] Sorting items in jQuery pseudo-array

2007-03-26 Thread Erik Beeson
Even easier than that: jQuery.fn.sort = function() { return this.pushStack( jQuery.makeArray( [].sort.apply( this, arguments )) ); }; See here: http://dev.jquery.com/ticket/255 Looks like I'm still about the only person that actually uses this. --Erik On 3/26/07, Luke Lutman <[EMAIL PROTE

Re: [jQuery] Sorting items in jQuery pseudo-array

2007-03-26 Thread Luke Lutman
I'd guess it's because arguments isn't really an array (it has a length property, but none of Array's methods). Something like this might do the trick: jQuery.fn.sort = function() { for(var i = 0, args = []; i < arguments.length; i++) args.push(i); return this.pushStack( [].s