title: Using Jeditable on DataTables with Ruby on Rails
body: <p>I have a DataTables table:</p>
  
  <pre><code>  %table.table.datatable#datatable
      %thead
        %tr
          %th Name
      %tbody
        - @cars.each do |car|
          %tr
            %td
              = car.name
  </code></pre>
  
  <p>And Jeditable code based on: <a href="http://datatables.net/release-datatables/examples/api/editable.html" rel="nofollow">http://datatables.net/release-datatables/examples/api/editable.html</a></p>
  
  <pre><code>:javascript
  $(document).ready(function() {
      /* Init DataTables */
      var oTable = $('#datatable').dataTable();
  
      /* Apply the jEditable handlers to the table */
      oTable.$('td').editable( 'update', {
          "callback": function( sValue, y ) {
              var aPos = oTable.fnGetPosition( this );
              oTable.fnUpdate( sValue, aPos[0], aPos[1] );
          },
          "submitdata": function ( value, settings ) {
              return {
                  "row_id": this.parentNode.getAttribute('id'),
                  "column": oTable.fnGetPosition( this )[2]
              };
          },
          "height": "14px",
          "width": "100%"
      } );
  } );
  </code></pre>
  
  <p>I get the following error when page loads:</p>
  
  <blockquote>
    <p>DataTables warning (table id = 'datatable'): Cannot reinitialise DataTable.
    To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy</p>
  </blockquote>
  
  <p>Add this before: <code>var oTable = $('#datatable').dataTable();</code></p>
  
  <pre><code>    $('#datatable').dataTable({   
        "bRetrieve":true,
        "bDestroy":true
      });
  </code></pre>
  
  <p>However, my table is still not editable!</p>