I am unable to add checkbox inside the table ,I tried lot of things but everything went to vain
Jquery Code:
$(document).ready(function() {
var total = [];
$.ajax({
url: 'user.json',
dataType: 'json',
success: function(json) {
// get the `airport` array
var device = json.siteList;
var j = 1;
// loop through the array to populate your list
$.each(device, function(i, sites) {
// console.log(sites.siteName)
// $('#data_table').append("<tr>" + "<td>" + sites.siteName + "</td>" + "</tr>");
$.each(sites.deviceList, function(i, values) {
item = {}
item['siteName'] = sites.siteName;
item["deviceName"] = values.deviceName;
item["count"] = values.count;
total.push(item);
});
});
$('#rpa_table').DataTable(
columnDefs: [{
orderable: false,
className: 'select-checkbox',
targets: 0
}],
select: {
style: 'os',
selector: 'td:first-child'
},
order: [
[1, 'asc']
], {
"aaData": total,
"aoColumns": [{
"sTitle": "Site",
"mData": "siteName"
},
{
"sTitle": "Cabinet",
"mData": "deviceName"
},
{
"sTitle": "Count",
"mData": "count"
},
],
});
}
});
// Handle click on "Select all" control
// Handle click on "Select all" control
$('#checkall').on('click', function() {
// Check/uncheck all checkboxes in the table
var rows = table.rows({
'search': 'applied'
}).nodes();
$('input[type="checkbox"]', rows).prop('checked', this.checked);
});
});
Every Time I add columnDef it shows me an error
The image is attached above, checked a lot of sites no clue nothing same error occures everytime any help would be highly appreciated Thanks in advance....................