title: EXTJS 5 : How to sort grid column in EXT JS 5
body: <p>I recently updated version of EXT JS to 5 and and override of doSort function no longer works. Someone an idea how to do ?</p>
  
  <p>Exampple of override : </p>
  
  <pre><code>{
      text: 'Custom',
      sortable : true,
      dataIndex: 'customsort',
      doSort: function(state) {
          var ds = this.up('grid').getStore();
          var field = this.getSortParam();
          ds.sort({
              property: field,
              direction: state,
              sorterFn: function(v1, v2){
                  v1 = v1.get(field);
                  v2 = v2.get(field);
  
                  return v1.length &gt; v2.length ? 1 : (v1.length &lt; v2.length ? -1 : 0);
              }
          });
      }
  }
  </code></pre>
  
  <p><strong>Edit 1 :</strong> 
  I just try the solution of @tomgranerod but the me.sortState is always 'undefined'.
  So I do this to update my variable : </p>
  
  <pre><code>    sort: function () {
          var me = this,
              grid = me.up('tablepanel'),
              store = grid.store;
  
          me.sortState = me.sortState === 'ASC' ? 'DESC' : 'ASC';
  
          Ext.suspendLayouts();
          me.sorting = true;
          store.sort({
              property: me.getSortParam(),
              direction: me.sortState,
              sortFn: function (v1, v2) {
                  v1 = v1.get(field);
                  v2 = v2.get(field);
  
                  return v1.length &gt; v2.length ? 1 : (v1.length &lt; v2.length ? -1 : 0);
              }
          });
          delete me.sorting;
          Ext.resumeLayouts(true);
      }
  </code></pre>
  
  <p>But the sortFn funcion is never called. I don't know why.
  ===> !!!! it works with EXT JS 5.0.1 but the sortFin function is always never called. !!!!</p>
  
  <p><strong>Edit 2 :</strong>
  This is what i attempt to have : </p>
  
  <p>ASC : </p>
  
  <pre><code>if (v1 and v2 are numbers) return v1 &gt; v2;
  else if (v1 is a number and v2 a string) return false;
  else if (v1 is a string and v2 a number) return true;
  else if (v1 and v2 are strings) return v1 &gt; v2;
  </code></pre>
  
  <p>DESC : </p>
  
  <pre><code>if (v1 and v2 are numbers) return v1 &lt; v2;
  else if (v1 is a number and v2 a string) return true;
  else if (v1 is a string and v2 a number) return false;
  else if (v1 and v2 are strings) return v1 &lt; v2;
  </code></pre>