I am trying to add a column for a toggle switch in my data table, but it's not working. It's just showing this text
When it should be like this
These are my codes
$(function(){
$('#table').DataTable({
processing: true,
serverSide: true,
ajax: '{!! URL::asset('/amenity/table') !!}',
columns : [
{ data: function (data) {return '<a href="amenity-details?id=' + data.id + '">' + data.name + '</a>';}, name: 'name' },
{ data: 'dayrate', name: 'dayrate' },
{ data: 'nightrate', name: 'nightrate' },
{ data: function(data){
return '<div class="switch switch-square" data-on-label=\"<i class=" fa fa-check"></i>\" data-off-label=\"<i class="fa fa-times"></i>\"> <input type="checkbox" class="status '+data.status+'" data-id="'+data.id+'" /></div>';
}, name: 'state', orderable: true, searchable: false},
{ data: 'action', name: 'action', orderable: false, searchable: false}
]
});
});
via user5156944