title: Datatable sorting when using Ajax datasource
body: <p>I'm new to Datatable and am trying to configure the Datatable, so that it fetches the data with ajax, displays it as a check-box, an anchor and a tab and allows a user to sort it. 
  I have the ajax and formatting part, however when I try to sort the check-boxes it does nothing. I looked up the <a href="http://www.datatables.net/examples/plug-ins/dom_sort.html" rel="nofollow">documented example</a> and took the sort handler from it:</p>
  
  <p>Code for sorting: </p>
  
  <pre><code>/* Create an array with the values of all the checkboxes in a column */
          $.fn.dataTableExt.afnSortData['dom-checkbox'] = function (oSettings, iColumn) {
              var aData = [];
              $('td:eq(' + iColumn + ') input', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
                  aData.push(this.checked == true ? "1" : "0");
              });
              return aData;
          }
  </code></pre>
  
  <p>Code for creating the checkbox:</p>
  
  <pre><code>    $('#example').dataTable({
          "bProcessing": true,
          "sAjaxSource": "sources/myData.json",
          "sAjaxDataProp": "items",
          "aoColumns": [
              {
                  "mData": function (source, type, val) {
                      if (source.Published)
                          return '&lt;input type="checkbox" checked="checked"/&gt;';
                      else
                          return '&lt;input type="checkbox" /&gt;';
  
                  },
                  //"sType": "dom-checkbox",
                  "sSortDataType": "dom-checkbox"
                  //, "bSortable": false
              },
              { "mData": "Author" },
              {
                  "mData": function (source, type, val) {
                      return '&lt;a href="' + source.Href + '"&gt;' + source.$name + '&lt;/a&gt;';
                  }
              }
          ]
      });
  </code></pre>
  
  <p>The sorting function ( <code>$.fn.dataTableExt.afnSortData['dom-checkbox']</code> is called and the data is returned, however the table isn't updated. (the code works but not for ajax tables).</p>
  
  <p>Data sample: </p>
  
  <pre><code>{
      "items": [
          {
              "$name": "a",
              "Href": "http://google.com",
              "Author": "a",
              "Published": true
          },
          {
              "$name": "c",
              "Href": "http://www.whiskas.at/",
              "Author": "a",          
              "Published": false
          }
      ]
  }
  </code></pre>