NOTE - Datatable serverside processing with MySql database
and the code is as follows
$(document).ready(function(){
var table = $('#userDataList').DataTable({
"processing": true,
"serverSide": true,
"ajax": "fetchData.php",
stateSave: 'true',
});
});
Also the table / page available at
http://testlearn.infinityfreeapp.com/index-old.html
1)
How to add a class to all
a) even rows dynamically.
b) odd columns dynamically.
2)
How to add a class with a button click to each odd rows with serverside processing with datatable ?
For example
$('tr:nth-child(odd)').addClass('whatever');
the above code is useful to add the code for the current page only.
But when we make a change like pagination / search / next page / order then the added class will disappears.
Also try something like
dt.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
var row = dt.row(this).node();
if ( rowIdx % 2 === 0 ) {
$( 'td:eq(3)', row ).addClass("yellow");
}
});
the above code also applies / works on the current page only.
value<0then add class red), you can do the same with css: egtable > tbody > tr:nth-child(odd) > td:nth-child(4)jsfiddle.net/vkcodtry (using Vincent's fiddle).