title: Sorting a JQuery list, populated from a JSon array
body: <p>I tried many different methods but can't seem to work this one out.
  I have a JSon array which populates my JQuery list. The list displays correctly, but I cant seem to be able to filter it.</p>
  
  <p>I'd like to be able to filter by name or price. I tried the JQuery .Filter method and many others, and they all failed. I'd also like to make it as a link. ( The user clicks sort by name, and it sorts... )</p>
  
  <p>Heres what I have so far, which I was convinced would work.</p>
  
  <p>Any help is greatly appreciated, Thanks !</p>
  
  <p>.js file :</p>
  
  <p><pre><code></p>
  
  <p>// Json array
  var productList = {"products": [
      {"description": "Product 1", "price": "3.25"},
      {"description": "Product 4", "price": "9.97"},
      {"description": "Product 3", "price": "4.21"},
      {"description": "Product 2", "price": "5.24"},
      {"description": "Product 5", "price": "8.52"}
  ]
  };</p>
  
  <p>function loadList() {</p>
  
  <pre><code>var list = $("#productList").listview();
  </code></pre>
  
  <p>// load array into list</p>
  
  <pre><code>$(productList.products).each(function(index) {
      $(list).append('&lt;li id="listitem"&gt;' + this.description + "  " +
              "    :     " + this.price + '&lt;/li&gt;');
  
       // sort by price 
       $(productList.products).filter(function ()
       { return parseFloat(this.price) &lt; 11;})
  </code></pre>
  
  <p>});</p>
  
      $(list).listview("refresh");
  
  }
  </code></pre>