title: DataTables sorts strings instead of numeric
body: <p>I am using <a href="http://datatables.net/" rel="noreferrer">jquery.datatables</a> to show numbers in datatables columns. Numbers are formatted to have spaces in between thousands unit (like <code>123 456 789</code>). Unfortunately, this number formatting provoques a <em>string</em> sorting instead of a <em>number</em> sorting (see the screenshot at the end of this question).</p>
  
  <p>I have identified that:</p>
  
  <ul>
  <li><code>function _fnSort(oSettings, bApplyClasses) {</code> is the core function for sorting.</li>
  <li>In this function, the <em>dynamic function sorting</em> approach is used (the one executed if <code>if (!window.runtime) {</code> is true)</li>
  <li><p>The <strong>string sorting functions</strong> used are the two following functions.</p>
  
  <pre><code>/*
  * text sorting
  */
  "string-asc": function(a, b) {
      var x = a.toLowerCase();
      var y = b.toLowerCase();
      return ((x &lt; y) ? -1 : ((x &gt; y) ? 1 : 0));
  },
  
  "string-desc": function(a, b) {
      var x = a.toLowerCase();
      var y = b.toLowerCase();
      return ((x &lt; y) ? 1 : ((x &gt; y) ? -1 : 0));
  },
  </code></pre></li>
  </ul>
  
  <p>My knowledge in javascript is pretty poor, what would be the best approach here?</p>
  
  <ol>
  <li>Tweak the string sorting function to detect the <em>number thousands formatted</em> case, and do the comparison (I guess this would be pretty slow on large data set).</li>
  <li>Provide a numerical sorting function dedicated for <em>number thousands formatted</em>? In that case 
  
  <ul>
  <li>how would you code that? </li>
  <li>how could I indicate to the core sorting function, to use this special numerical sorting function?</li>
  </ul></li>
  </ol>
  
  <p>Here is what the sorting look like by now:</p>
  
  <p><img src="https://i.stack.imgur.com/PnjtH.png" alt="enter image description here"></p>