How can a force a redraw even though the data has not changed?

How can a force a redraw even though the data has not changed?

Keith_HKeith_H Posts: 54Questions: 19Answers: 1

When a certain column gets rendered, it checks if a checkbox on the page is checked. If it is, then then cell gets a background colour. All this works great.

My problem is that I would like to tell datatables to redraw the contents as the flag has been changed.

I have tried

$('#tblOrderMaintLines').DataTable().rows().invalidate().draw();    

The data is loaded by :

            dTable.row.add([
                 Col1
                ,Col2
                ,etc
            ]);

I've used invalidate before and it's worked, but this has been when updating the data (add, change or delete). By this I mean, I can delete a row, invalidate the data and the table redraws/renders OK.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @Keith_H ,

    The best place to do with would be rowCallback, as this is called on every draw. That way, the colour will always be current.

    Cheers,

    Colin

  • Keith_HKeith_H Posts: 54Questions: 19Answers: 1

    Thanks Colin, that worked.

This discussion has been closed.