How to add extra columns and corresponding rows after after initializing the dataTable ?

How to add extra columns and corresponding rows after after initializing the dataTable ?

mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

Dears,

I'm using the dataTables, here after initializing the dataTable, I need to add the four columns and corresponding data to columns by calling the webservice.

Is it possible to add four extra columns ?, If yes which functions I need to use.
OR
Is it possible to update the column data ?!

Thank you very much in advance.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 4,694Questions: 0Answers: 823
    edited September 2018 Answer ✓

    Hi @mallikpk4u ,

    It's not possible to add columns after the table has been initialised, but yep, you can update the column data for each row with row().data(), or multiple rows with rows().data(). You can also update cell/cells with cell().data() and cells().data(),

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 5,543Questions: 19Answers: 1,233

    As Colin mentioned you can't add new columns. You would need to use destroy() to remove the Datatable then reinitialize with the new settings then add all the data. Another option is to hide these additional columns on initialization using columns.visible. Then use columns().visible() to display them when ready.

    Kevin

  • mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

    Thank you Colin and Kevin.

Sign In or Register to comment.