admin管理员组文章数量:1415654
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');
}
}
});
本文标签: javascriptrowCallback and createdRow not highlighting rowStack Overflow
版权声明:本文标题:javascript - rowCallback and createdRow not highlighting row - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745179400a2646397.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论