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 ?
mallikpk4u
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
This discussion has been closed.
Answers
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 withrows().data()
. You can also update cell/cells withcell().data()
andcells().data()
,Cheers,
Colin
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 usingcolumns.visible
. Then usecolumns().visible()
to display them when ready.Kevin
Thank you Colin and Kevin.