How can I change background color of a cell after edit?

How can I change background color of a cell after edit?

johnsonjjohnsonj 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

Answers

  • allanallan Posts: 63,831Questions: 1Answers: 10,518 Site admin
    Answer ✓

    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 the td for that cell.

    Allan

  • johnsonjjohnsonj Posts: 14Questions: 3Answers: 0

    That's it! Yes I am doing inline cell by cell editing. Thanks! Final code:

     var modifier = editor.modifier();
     var cell = table.cell(modifier).node();
     $(cell).addClass('pinkCell');
    
This discussion has been closed.