you can use something like this : 

sample_array.sort(sortElemByDate)

function sortElemByDate(el1, el2) {
    
    if (el1.page.endDate<el1.page.endDate) {
        return -1;
    } else if (el1.page.endDate>el2.page.endDate) {
        return 1;
    } else {
        return 0;
    }    
}


grimmwerks <[EMAIL PROTECTED]> wrote: OK, not sure of a way around this one, 
would appreciate any help (I
have a sneaky suspicion I'll be rolling my own) --

I've got an array of objects, -- ie x = Array([object],[object],[object]);

Where each object has another object -- 'page' -- and then THAT has a
key of 'endDate' -- ie

[object].page.endDate


Is there a way I can sort this array by endDate even though it's not a
key of the toplevel, but the next level?

Will I instead have to create a new array and then based on what's
already there (ie at '0' or 'length-1' to either push or splice at the
beginning based until the original array is empty?
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


                        
---------------------------------
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small 
Business.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to