title: JQuery Datatables set checkbox to checked
body: <p>I am currently using JQuery datatables to store information into and am populating it using a MD array.</p>
  
  <p>But I want to by default set the check box property to <code>:checked</code> if conditions were met. I have tried various ways such as <code>.addclass</code> &amp; <code>.addprop</code> to find any workarounds but I have not been able to get it working how I need it.</p>
  
  <p>E.G So if value is disable do nothing, else if enable set the checkbox value to <code>:checked</code>.</p>
  
  <p>I have attached a <a href="https://jsfiddle.net/kshrqoLm/1/" rel="nofollow">JSfiddle</a> to replicate the issue I am having.</p>
  
  <p>The code for that is then:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;table id="userTable" class="display" width="100%"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Enable/Disable&lt;/th&gt;
        &lt;th&gt;Number&lt;/th&gt;
        &lt;th&gt;Name&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>Javascript/JQuery</strong></p>
  
  <pre><code>jQuery(function($) {
    data = [
      ['User_488', 'User 1', 'disable'],
      ['User_487', 'User 2', 'disable'],
      ['User_477', 'User 3', 'disable'],
      ['User_490', 'User 4', 'disable'],
      ['1000', 'User 5', 'enable'],
      ['1001', 'User 6', 'enable'],
      ['1002', 'User 7', 'enable'],
      ['1004', 'User 8', 'enable']
    ]
  
    var t = $('#userTable').DataTable({
      'columnDefs': [{
        'targets': 0,
        'searchable': false,
        'orderable': false,
        'className': 'dt-body-center',
        'render': function(data, type, full, meta) {
          return '&lt;input type="checkbox" class="checkbox_check"&gt;';
        }
      }],
      order: []
    });
  
    function checkbox() {
      t.clear();
      if (data) {
        for (var i = 0; i &lt; data.length; i++) {
          var number = data[i][0];
          var name = data[i][1];
          var statustemp = "";
          var resarr = new Array(statustemp, number, name);
          if (status === "disable" || status == null) {
            t.row.add(resarr).draw(false);
          } else {
            t.row.add(resarr).draw(false);
          }
        }
        t.draw(false);
      }
    };
    checkbox();
  });
  </code></pre>
  
  <p>Anyone had this issue before?</p>