Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Sorting Array

Sorting an Array

Looks like we don't have access to:

'array.sort(function(a,b) { return a < b; });'

Started with Titanium today, haven't figured out how to sort a Table List yet.

— asked March 26th 2010 by Mark Walker
  • array
  • javascript
  • sort
0 Comments

1 Answer

  • Accepted Answer

    this worked for me, but it was for an object with a "timestamp" property

    tmpData.sort(compareTime);
    
    function compareTime(a, b) {
        return b.timestamp - a.timestamp;
    }
    
    — answered March 26th 2010 by Robert Carlsen
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.