Table draw issue.

Table draw issue.

tkareztkarez Posts: 2Questions: 1Answers: 0

I am loading a table dynamically, I clear it, add new data, set the sort order and then draw it, as below.

var table = $('#tbl_tech_mon').DataTable();
table.clear().rows.add(data);
table.order([2, 'asc'])
table.draw();

When I do that the table does not render correctly. The header columns do not align properly.

If I manually re-sort the table by clicking a header column it fixes itself or if I call a second draw statement that also works to fix the header alignment. I don't see that I am doing anything wrong?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    Call columns.adjust() once the table has been populated with the new data.

    Allan

  • tkareztkarez Posts: 2Questions: 1Answers: 0

    Perfect, thanks for the super fast response!

Sign In or Register to comment.