Possible to Dynamically Remove or Add a Column?

Possible to Dynamically Remove or Add a Column?

chobo2chobo2 Posts: 23Questions: 2Answers: 0
edited February 2012 in General
Hi I am wondering once the table is rendered is it possible to add another column header? or remove a column header and add cell for this header for each row?

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    No I'm afraid not. Currently there is no method in DataTables to dynamically add and remove columns. It is perfectly possible to do, it just needs the API code to do it written...!

    Allan
  • chobo2chobo2 Posts: 23Questions: 2Answers: 0
    Hmm. I guess this then I going to have to do some hacky solution or something. I think I can get all the cells of that column then just remove them through the dom. What should I use to re-render the table again? So I do a destroy then recreate again or some sort of draw?
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Basically yes - bDestroy or fnDestroy are the options to destroy the table. The obvious downside is that they require a fair bit of overhead.

    Allan
This discussion has been closed.