dimanche 25 octobre 2015

How to add checkbox to the first column header DataTable

I have a DataTable, HTML FILE: , in my coffeescript file I am initializing the DataTable:

didInsertElement: (->

table =  Ember.$('#example').DataTable({
   "processing": true,
   "serverSide": true,
   "pagingType": "input",
   "searchable": false,
   "sDom": '<"top"l>rt<"bottom"ip><"clear">',
   'columnDefs': [{
     'targets': 0,
     'searchable': false,
     'orderable': false,
     'className': 'dt-body-center',
     'render': () ->
        '<input type="checkbox">';
  }],
   ajax: 
    {
     "url": "string"
     "dataSrc": "src"
    }

   columns: [
        { "name":"select", "title": "hey"},
        { "name":"integer", "title": "ID", "data": "id"},
      ]   
  })

So I dont know how render exactly work in the columnDefs but it adds a checkbox next to the row. If I add then it will not override. Is there a way for me to change the column title so the first column has a checkbox and I can select all rows/deselect all from it. Been stuck on this since a long time.




Aucun commentaire:

Enregistrer un commentaire