How can I change background color of a cell after edit?
How can I change background color of a cell after edit?
johnsonj
Posts: 14Questions: 3Answers: 0
I am trying to change the color of a cell based on cell row, column index but its not working. Can anyone help?
editor.on('postEdit', function (e, json, data) {
//if dialog was open, update it
var isOpen = $('#dialog').dialog('isOpen');
if ( isOpen === true) {
var dtls = data[HourBeingEdited + '_rsrc_hrly_details'];
RefreshPopup(dtls, RsrcBeingEdited, HourBeingEdited);
}
//This refresh makes sure that the cell color is correct. Should be pink if schedule has changed.
var modifier = editor.modifier();
var rowIdx = table.row(modifier).index();
var colIdx = table.column(modifier).index();
var cell = table.cell(rowIdx, colIdx);
$(cell).closest('td').addClass('pinkCell');
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What is the modifier in this case? It is a cell that you are using to trigger the editing? If so, use
table.cell( modifier ).node()
to get thetd
for that cell.Allan
That's it! Yes I am doing inline cell by cell editing. Thanks! Final code: