Class name to Datatable field
Class name to Datatable field
Sand
Posts: 6Questions: 0Answers: 0
I have following code for datatable:
Obj.DataTable = $('#mobile-datatable').DataTable( {
"ajax": {
"url" : '/Mobile/list/' + Obj.name,
"dataSrc": function(chek) {
return chek.data;
},
"responsive": true,
"order": [],
"columns": [
{ "data": "mobile_num"},
{ "data": "mobile_model" },
{ "data": "mobile_price" },
{ "data": "mobile_feature" },
]
} );
This is working fine, But I need to add class name for 2nd field - mobile model. I tried
"columnDefs": [
null,
{ className: "mobile_model", "targets": [ 0 ] },
null,
null,
]
Above code gives me error "TypeError: def is null". Anyone please help me to assign class name to the datatable fields?
This discussion has been closed.