How to add columns dynamically basing on json data
How to add columns dynamically basing on json data
pravs
Posts: 29Questions: 4Answers: 0
Hi,
I want to add columns dynamically to the data table basing on the ajax success response, please any one help me, as it is urgent.
This discussion has been closed.
Answers
It is more help full if you explain the above scenario for Row grouping jquery data tabale
Here is an example I put together previously:
http://live.datatables.net/fafuyeyu/1/edit
It generates the columns from the field names returned. You can return a separate object in the JSON with the column names and use the same structure.
Doesn't include row grouping but you can use this example as a basis:
https://datatables.net/examples/advanced_init/row_grouping.html
Kevin
Thanks, For your help but i am getting this error
DataTables warning: table id=example - Requested unknown parameter '0' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4
In the above code your fixing the header columns in the table, Even i need that header columns to be dynamic
What are the results of the troubleshooting steps provided in the link?
Are you saying that in the example the headings are defined in HTML? You can remove the thead and tfoot to see the columns headings are defined by the filed names in the JSON.
Kevin