title: JavaScript backbone collection sort on multiple fields
body: <p>I have data like</p>
  
  <pre><code>-------------------------
  id | name | parentId
  -------------------------
  1  | a    |
  2  | z    |
  3  | b    |
  4  | z1   | 2
  5  | y2   | 1
  6  | y1   | 1
  7  | y3   | 1
  -------------------------
  </code></pre>
  
  <p>in backbone collection.</p>
  
  <p><strong>I want to sort on the field name but child object should be placed just below parent(<em>based on parentId</em>),</strong> 
  i.e.</p>
  
  <pre><code>-------------------------
  id | name | parentId
  -------------------------
  1  | a    |
  6  | y1   | 1
  5  | y2   | 1
  7  | y3   | 1
  3  | b    |
  2  | z    |
  4  | z1   | 2
  -------------------------
  </code></pre>
  
  <p>Here y1, y2 and y3 is up because they are child of a(id 1).</p>
  
  <p>I am using backbone collection comparator.
  (But comparator in just javasript will do to - I will converto to backbone comparator).</p>