title: Proper way to sort a backbone.js collection on the fly
body: <p>I can successfully do this:</p>
  
  <pre><code>App.SomeCollection = Backbone.Collection.extend({
    comparator: function( collection ){
      return( collection.get( 'lastName' ) );
    }
  });
  </code></pre>
  
  <p>Which is nice if I want to have a collection that is only sorted by 'lastName'. But I need to have this sorting done dynamically. Sometimes, I'll need to sort by, say, 'firstName' instead.</p>
  
  <p>My utter failures include:</p>
  
  <p>I tried passing an extra variable specifying the variable to <code>sort()</code> on. That did not work. I also tried <code>sortBy()</code>, which did not work either. I tried passing my own function to sort(), but this did not work either.  Passing a user-defined function to <code>sortBy()</code> only to have the result not have an <code>each</code> method, defeating the point of having a newly sorted backbone collection.</p>
  
  <p>Can someone provide a practical example of sorting by a variable that is not hard coded into the comparator function? Or any hack you have that works? If not, a working <code>sortBy()</code> call?</p>