title: Simple custom sorting function for jQuery DataTables
body: <p>Numeric sorting is not working on my dataset. So I made a custom sorting that converts whole string into number then sorts based on that, but for some reasons its not working. What am i missing here?</p>
  
  <pre><code>$.fn.dataTableExt.oSort["test-desc"] = function (x, y)
  {
  
           x = parseInt(x);
          y = parseInt(y);
  
          if ( x &lt; y)
          {
              return 1;
          }
  
          return 0;
  
  
  };
  
  $.fn.dataTableExt.oSort["test-asc"] = function (x, y)
  {
  
      x = parseInt(x);
      y = parseInt(y);
  
      if ( x &gt; y)
      {
          return 1;
      }
  
      return 0;
  
  }
  
  $('table').DataTable({
      "pageLength": 300,
      "bLengthChange": false,
      "columnDefs": [
      { "type": "test", targets: 3 }
      ]
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/mQXad.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mQXad.png" alt="enter image description here"></a></p>
  
  <p>Both ascending and descending are not working properly. I have checked these functions are being called and properly converting strings to numeric instances.</p>