Exclude columns from ajax.reload

Exclude columns from ajax.reload

isostormisostorm Posts: 2Questions: 1Answers: 0

Hi all, first of all I want to tell that I really enjoy using Datatables. Especially because there is a lot of documentation available. However I can't seem to find how to exclude columns from refreshing with ajax reload.

The situation is as follows, I have a table with a lot of columns that remain unchanged, only a couple columns need continuous refreshing, now I use ajax reload to reload the whole table every 10s. This creates a lot of bandwith. So I was wondering if there is any way that I can put these unchanged columns just in plain HTML and only use ajax reload to refresh those couple columns that need it?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    An ajax.reload() call is basically the same as doing clear() followed by rows.add() (with the Ajax call to get the data of course). So there isn't a way for it to get just specific columns since it really does reload the table's data.

    However, what you can do is use cell().data() to update the data for a specific cell. You'd make your own Ajax call to get the data you need and then loop over it and update the cell(s) as required.

    Regards,
    Allan

  • isostormisostorm Posts: 2Questions: 1Answers: 0

    Thanks for your answer. I'll update the columns manually.

This discussion has been closed.