title: DataTables order by number field
body: <p>i have a column that represents money values in my <a href="http://datatables.net/index" rel="nofollow"><strong>DataTable Grid</strong></a>, how can i order this values correctly, because dataTable order only by the first number like example:</p>
  
  <p>9.000,00</p>
  
  <p>8.000,00</p>
  
  <p>5.454.043,00</p>
  
  <p>4.454.043,00</p>
  
  <p><strong>of course that it's supposed to be like this:</strong></p>
  
  <p>5.454.043,00</p>
  
  <p>4.454.043,00</p>
  
  <p>9.000,00</p>
  
  <p>8.000,00</p>
  
  <p>i'm using <code>number_format</code> to set my money format.</p>
  
  <p><strong>php:</strong></p>
  
  <p><code>&lt;td&gt;".number_format($money,2,',','.')."&lt;/td&gt;</code></p>
  
  <p>any question, be my guest.</p>
  
  <p>Thanks.</p>
  
  <hr>
  
  <p><strong>edit:</strong></p>
  
  <p>as answer by @Mikhail , try this, but the column in position <a href="http://datatables.net/usage/columns#iDataSort" rel="nofollow">3</a> dont sort any more.</p>
  
  <pre><code> ...
  "aoColumnDefs": [
    { "sType": "numeric", "aTargets": [ 3 ] }
  ],
  ...
  </code></pre>
  
  <hr>
  
  <p><strong>edit 2</strong></p>
  
  <p>little more code:</p>
  
  <p><strong>php:</strong></p>
  
  <pre><code>while(!$res-&gt;EOF){
      ... // post only the 3 &lt;td&gt; position
     &lt;td style='text-align: right;'&gt;".number_format($value,2,',','.')."&lt;/td&gt;
     ...
     $res-&gt;MoveNext();
  }
  </code></pre>
  
  <p><strong>js DataTable</strong></p>
  
  <pre><code>var oTable = $('#example').dataTable({
                      "bJQueryUI": true,
                      "sScrollY": "225px",
                      "sScrollX": "100%",
                      "sScrollXInner": "100%",
                      "bDestroy" : true,
                      "bScrollCollapse": true,
                      "aoColumnDefs": [
                          { "sType": "numeric", "aTargets": [ 3 ] }
                      ],
                      "sDom": '&lt;"H"Tfr&gt;t&lt;"F"ip&gt;',
                      "oTableTools": {
                          "sSwfPath": "js/DataTables/extras/TableTools/media/swf/copy_cvs_xls_pdf.swf",
                          "sRowSelect": "single",
                          "aButtons": [
                                          {
                                              "sExtends": "xls",
                                              "sButtonText": "Excel"
                                          },
                                          {
                                              "sExtends": "print",
                                              "sButtonText": "Print"
                                          }
                                      ]
                      },
                      "aaSorting": [[ 0, "asc" ]],
                      "bPaginate": false
                  });
  </code></pre>
  
  <hr>
  
  <p><strong>Solution</strong></p>
  
  <p>my solution was create a new column with the value without <code>number_format</code>, hidden them like <a href="http://datatables.net/examples/basic_init/hidden_columns.html" rel="nofollow"><strong>this</strong></a>. Searching some other's way of sort, i fount the <a href="http://datatables.net/usage/columns#iDataSort" rel="nofollow"><strong>iDataSort</strong></a>
  now i can format anything in my showing column.</p>