title: jquery datatable checkbox click to select a row
body: <p>I have a <code>jquery</code> <code>datatable</code> with checkboxes in first column. For each checkbox select/deselect I want to update a status field of corresponding row in database. I could attach click event handler to the checkboxes. 
  With each checkbox click, I want to</p>
  
  <ol>
  <li>mark the row containing a <code>checked</code> <code>checkbox</code> as selected.</li>
  <li>Get the row data associated with clicked <code>checkbox</code>.</li>
  </ol>
  
  <p>The code I have done so far:</p>
  
  <pre><code>$('#newItemBasketTab').dataTable({
      "fnDrawCallback": function( oSettings ) {
         $('.ibchkclass').click(function() 
         {
            updateItemBasket(this);
         });
      },
  
      "aaData": result.itembasketdata,
      "aoColumnDefs":
      [
         {"aTargets": [0],"width": "5%","sClass": "centre_class","mData": "item_basket_id",
          "mRender": function ( data, type, full ){
            var checkedStatus = '';
            if(data != null) { checkedStatus = "checked"; }
            return "&lt;input type='checkbox' class=\"ibchkclass\" id=\"chk_" + full.id1 + "_" + full.id2 + "\" " + checkedStatus + "&gt;";
           }
         },
         {"aTargets": [1],"width": "35%","mData": "name"},
         {"aTargets": [2],"width": "10%","sClass": "price_class", "mData": "prod_quantity"},
         {"aTargets": [3],"width": "10%", "sClass": "price_class", "mData": "prod_value"}
      ]
  });
  
  function updateItemBasket(cb)
  {
      var cbid = cb.id;
      if( $('#'+cbid).is(':checked') == true)
      {
          alert('true');
          //Select respective row
          //Get item_basket_id, prod_quantity and prod_value
      }
      else
      {
  
      }
  }
  </code></pre>
  
  <p>Thanks.</p>