Here is the code which reads values from database and diplay them in the Jquery DataTable.
This code generate automatic rows and i want to add some custom classes can any one tell me how to do that
i inspected the Code It Adds
$(document).ready(function () {
//jQuery DataTables initialization
$('#myDatatable').DataTable({
"processing": true, // for show processing bar
"serverSide": true, // for process on server side
"orderMulti": true, // for disable multi column order
"dom": '<"top"i>rt<"bottom"lp><"clear">', // for hide default global search box // little confusion? don't worry I explained in the tutorial website
"ajax": {
"url": '/Users/GetAllUsers',
"type": "POST",
"datatype": "json"
},
"columns": [
{
"data": "User_FirstName", "autoWidth": true
},
{
"data": "User_LastName", "autoWidth": true
},
{ "data": "User_IsActive", "autoWidth": true },
{ "data": "User_Email", "autoWidth": true },
{ "data": "User_UserName", "autoWidth": true },
//{ "data": "User_UserType", "autoWidth": true },
{
"data": "User_Id",
"render": function (data, type, full, meta) {
var v_count = full['User_IsActive'];
if (!v_count) {
return '<a class="btn btn-verify " href="#">Enable<i class="fa fa-check wow fadeInRightBig"></i></a>';
} else if (v_count) {
return '<a class="btn btn-verify " href="#">Disable<i class="fa fa-ban wow fadeInRightBig" aria-hidden="true"></i></i></a>';
}
}
},
{
"data": "User_Id",
"render": function (data, type, full, meta) {
var v_count = full['User_UserType'];
if (v_count!=null) {
return '<a class="wow fadeInRightBig" href="#">' + v_count + '<i class="fa fa-check "></i></a>';
} else if (v_count) {
return '<a class="btn btn-verify " href="#">Disable<i class="fa fa-ban wow fadeInRightBig" aria-hidden="true"></i></i></a>';
}
}
}
]
});