Column color when reload ajax
Column color when reload ajax
Hello All, Help me please.
I'm having trouble rebooting AJAX, when I restart ajax, then the color of the column disappears.
Maybe, someone knows how to solve this problem?
My render code.
Video - https://drive.google.com/file/d/1uXXtXEIkoXw-u4MSZ4RY7WsOVcgyrD0D/view?usp=sharing
My full code - https://pastebin.com/iFUwRsV1
"render": function (data, type, full, meta) {
var cellText = $(data).text();
if (type === 'display' && (cellText == "Так" || data == 'Так')) {
var rowIndex = meta.row + 1;
var colIndex = meta.col + 1;
$('#table tbody tr:nth-child(' + rowIndex + ') td:nth-child(' + colIndex + ')').css('background-color', '#ff9797').css('color', '#ffffff');
return data;
} else {
return data;
}
}
This discussion has been closed.
Replies
Interesting demo, thanks,. My guess is that the
rowIndexand/orcolIndexare not what you expect them to be during reload. Hard to say though without seeing it in action. You could try someconsole.logstatements in your render function to see what's happening.However using
columns.renderis not intended for manipulating thetrelements. You should usecreatedRoworrowCallbackorcolumns.createdCellfor this.Kevin
@kevin Thanks!!! I used this code! Maybe someone else will come in handy.
live.datatables.net/yiceculu/1/edit