How to add columns dynamically basing on json data

How to add columns dynamically basing on json data

pravspravs 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.

Answers

  • pravspravs Posts: 29Questions: 4Answers: 0

    It is more help full if you explain the above scenario for Row grouping jquery data tabale

  • kthorngrenkthorngren Posts: 20,329Questions: 26Answers: 4,774

    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

  • pravspravs Posts: 29Questions: 4Answers: 0

    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

  • pravspravs Posts: 29Questions: 4Answers: 0

    In the above code your fixing the header columns in the table, Even i need that header columns to be dynamic

  • kthorngrenkthorngren Posts: 20,329Questions: 26Answers: 4,774

    Requested unknown parameter '0' for row 0, column

    What are the results of the troubleshooting steps provided in the link?

    In the above code your fixing the header columns in the table, Even i need that header columns to be dynamic

    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

This discussion has been closed.