I followed the documentation from the Jquery Datatable site, as well as SO posts, to use rowCallback to highlight the row based on value.
let SET1 = $("#SET1").DataTable({
"columns": columns,
"rowCallback": function( row, data, index ) {
if ( data[0] == "jon" )
{
$('td', row).css('background-color', 'Red');
}
}
});
However, nothing I have tried rowCallback,createdRow or the fnrowCallback is making the row to change color. Is it the way I'm loading the data?
below is my fiddle. /
I followed the documentation from the Jquery Datatable site, as well as SO posts, to use rowCallback to highlight the row based on value.
let SET1 = $("#SET1").DataTable({
"columns": columns,
"rowCallback": function( row, data, index ) {
if ( data[0] == "jon" )
{
$('td', row).css('background-color', 'Red');
}
}
});
However, nothing I have tried rowCallback,createdRow or the fnrowCallback is making the row to change color. Is it the way I'm loading the data?
below is my fiddle. http://jsfiddle/czcz/qfr3xLq1/5/
Share Improve this question asked Apr 27, 2017 at 20:17 causitacausita 1,7081 gold badge23 silver badges35 bronze badges1 Answer
Reset to default 6rowCallback
is called once for each row. It is not an array, but an object. Try this:
let SET1 = $("#SET1").DataTable({
"columns": columns,
"rowCallback": function( row, data, index ) {
if ( data.name == "jon" )
{
$('td', row).css('background-color', 'Red');
}
}
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745179401a4615350.html
评论列表(0条)