realtime updating table

realtime updating table

redisentredisent Posts: 4Questions: 2Answers: 0

I am updating a table in realtime with the following code

    function updateCell(row, col, newVal) {
        console.log('updateCell', row, col, newVal);
        var prevVal = dt1.cell(row, col).data();
        var cellNode = dt1.cell(row, col)
            .data(newVal)
            .draw(false)
            .node();
        $(cellNode)
            .css({ backgroundColor: newVal > prevVal ? 'green' : 'red' })
            .animate({ backgroundColor: 'white' }, 1500);
    }

when i do this the focus is changed to the cell that is updated. This is causing me a problem when using inline editing (editor loses focus). Is there a way to update the cell without changing the focus? or a workaround?

R

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @redisent ,

    If you remove the draw() it's working for me - see here (click on any cell in the table).

    Hope that does the trick,

    Cheers,

    Colin

This discussion has been closed.