Reputation: 702
Simple but I am not being able to change this table background color. I am binding datatable using jQuery ajax call. Any help will be good.
$.ajax({
type: "POST",
datatype: "json",
data: { Alert: true },
url: '/GunTracking/GetGunAlertsList',
success: function (data) {
debugger;
var table = $('#GunTracking-detail-datatable').DataTable();
table.clear().draw();
for (var i = 0; i < data.length; i++) {
var id = data[i].GunId;
var remarks = '<button type="button" title="Remarks" class="btn btn-xs btn-default" data-toggle="modal" data-target="#gun-tracking-remark-popup" onclick="javascript: OpenRemarks ('+id +')" ><i class="fa fa-info-circle"></i></button>';
var rowNode = table.row.add([
//data[i].GunId,
data[i].BranchName,
data[i].GunSerialNo,
data[i].GunTypeName,
data[i].ModelNo,
data[i].CarriedBy,
data[i].Bullets,
data[i].Purpose,
data[i].IssueDate,
data[i].IssueTime,
data[i].TotalEstimatedTime,
remarks,
]);
}
table.draw();
}
});
Upvotes: 3
Views: 13908
Reputation: 5699
I'm guessing something like this CSS should do the trick:
#GunTracking-detail-datatable{
background-color:#eee;
}
If you really want to go to town and alter the whole of the stuff DataTables gives you'd need to have something like this:
#GunTracking-detail-datatable_wrapper{
background-color:#eee;
}
Hope that helps, example here.
Upvotes: 2