locked
Sort a list of key value pairs in HTML app?

    Question

  • Just a n00b on Metro with JavaScript, but I can't seem to find a way to create a sorted list of key-value pairs (simply sorted by key). I know I can put them in an array and sort them myself, but am hoping there's a better solution. Any suggestions?

    thanks,

    shane

    Saturday, May 19, 2012 8:07 PM

Answers

  • If you are talking about a List object (something that would be shown in a ListView, for example), there are the createSorted() and sort() methods.
    Sunday, May 20, 2012 10:58 AM
  • I actually wasn't talking about a List object, because this is data for internal use in the app (building an OAuth header), not something that will be displayed. I ended up just writing a compare function and using javascript's sort method.
    • Marked as answer by shanemcr Wednesday, May 30, 2012 4:07 AM
    Wednesday, May 30, 2012 4:07 AM

All replies

  • If you are talking about a List object (something that would be shown in a ListView, for example), there are the createSorted() and sort() methods.
    Sunday, May 20, 2012 10:58 AM
  • I actually wasn't talking about a List object, because this is data for internal use in the app (building an OAuth header), not something that will be displayed. I ended up just writing a compare function and using javascript's sort method.
    • Marked as answer by shanemcr Wednesday, May 30, 2012 4:07 AM
    Wednesday, May 30, 2012 4:07 AM