title: How to bind checkbox value dynamically from database using jQuery Datatables plugin
body: <p>I am using <a href="https://www.datatables.net" rel="nofollow">jQuery DataTables</a> plugin for displaying data. Here I have a column with checkbox which should be checked or unchecked according to the values from the database, i.e. if the value from the db is <code>true</code> checkbox should be checked and if value from db is <code>false</code> checkbox should be unchecked.</p>
  
  <p>Here is what I have tried so far.</p>
  
  <pre><code>table = $("#dataTableMenuRole").dataTable({
          "ajax": {
              "url": "@Url.Action("LoadGridView", "MenuSettings")",                
              "method": "POST",
              "dataType": "json",
              "data": function (d) {
                  d.roleId = $("#ddlRoles").val()
              }
          },
          columns: [
              { "data": "MenuName" },
              { "data": "CanAdd" }               
  
          ],            
          "bProcessing": true,
          "aoColumnDefs": [{
              "targets": 1,
              "bSortable": false,
              "mRender": function (data, type, full, meta) {
                  return '&lt;input type="checkbox" class="minimal" checked="'+data+'"/&gt;'
              }
          }]
      });
  </code></pre>
  
  <p><strong>The JSON returned from the db is</strong> </p>
  
  <pre><code>{"data":[{"MenuName":"Roles","CanAdd":true},{"MenuName":"Menu","CanAdd":true},{"MenuName":"ServiceTax","CanAdd":false}]}
  </code></pre>