Inline Editor - after edit, change color of another cell
Inline Editor - after edit, change color of another cell
Using the inline editor, after making the edit, I want to change the color of a different cell if something was entered that needs to be called out.
For example, you inline edit a numeric field, and that value causes another field to go below 0. I want to highlight that other field.
I tried the following, but the field (index 10) doesn't actually change color.
editor.on('postSubmit', function (e, json, data) {
var modifier = editor.modifier();
var currentRow = table.row(modifier);
if (json.data[0]["MyCustomField1"] > json.data[0]["MyCustomField2"]) {
$('td', currentRow).eq(10).css('color', 'Red');
} else {
$('td', currentRow).eq(10).css('color', 'Black');
}
});
Performing the same logic on CreatedRow on the table does work:
What am I missing?
This question has an accepted answers - jump to answer
Answers
Should be:
i.e. get the
tr
element for the selected row (usingrow().node()
) and then use that in the selector for jQuery. At the moment your jQuery selector is getting a DataTables API instance passed into it.Regards,
Allan
That was it!
Thank you very much for your help!
(sory for the late reply)