Change cell css background after edit

Change cell css background after edit

Gotcha007Gotcha007 Posts: 13Questions: 3Answers: 0
edited August 2017 in Free community support

Hi guys.
I would like to change the css background property of a cell after I edit it.

For the moment I do have my cell/column created like this:

{ 
                    "data": "db_ob_Main.Approved",
                    "render": function (val, type, row){
                        if (val == 0){
                            return "Not approved";
                        }else{
                            return "Approved";
                        }
                    },
                    "fnCreatedCell": function(nTd, sData, oData, iRow, iCol){
                        if(sData == 0){
                            $(nTd).css('background-color', 'red');
                        }else{
                            $(nTd).css('background-color', 'green');
                        }
                    }
}

It's working well at the creation and match the color but after I edit, the background color stays the same...

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Answer ✓

    You need to use rowCallback for this at the moment, and modify the cell in the row. There isn't currently an updatedCell callback (yet).

    Allan

  • Gotcha007Gotcha007 Posts: 13Questions: 3Answers: 0

    Works perfectly! Thanks a lot!

This discussion has been closed.