how to change css on an inline edit

how to change css on an inline edit

hbanaharishbanaharis Posts: 32Questions: 14Answers: 3
edited April 2017 in Editor

Hi I've assigned a class to a column as follows:

{ className: "myclass", "targets": [ 6 ] },

What is the appropriate way to have this command executed following an inline edit:

$('.myclass').filter(function(index){ return parseInt(this.innerHTML) < 20; }).css({'color':'red', 'text-decoration':'underline'});

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    The rowCallback option is the way to do this at the moment. There isn't currently an update event that is triggered by DataTables.

    Another option might be to use postEdit which would be more efficient processing-wise, but it wouldn't set the style for the initial display.

    Allan

  • hbanaharishbanaharis Posts: 32Questions: 14Answers: 3

    Thank you for your prompt reply. I've implemented your suggestion and it works. A further question: how would one implement the CSS only on the row that was edited?

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    The logic applied by the rowCallback will always be applied to the rows that are drawn in the table - all rows. Only using postEdit could you modify only that one row.

    Allan

This discussion has been closed.