I need to render entire table dynamically including multi level headers
I need to render entire table dynamically including multi level headers
25aravinth
Posts: 2Questions: 0Answers: 0
Hi Team, Please help me to form entire table dynamically which has multilevel headers. I have shared example table structure below, Also please guide me like how to form json data for multi level header tables so that I will form that and retrieve from backend API. My use case is like I should not hardcode any table header columns, because headers will differ for each service call. Please help with json data and script to this use case. Thanks in advance.
Replies
This example should help, it's demonstrating the use of
rowspan
andcolspan
within the header,Colin
Hi Colin, thanks for your suggestion, but I could see only static content example, is there any reference for my use case?
That is not something built into Datatables. This FAQ explains how you can do this. Basically return the column definitions in the JSON response and use Javascript or jQuery methods to populate the DOM with the complex header and build the column definitions.
This example is close to what you want. Since its using a single header it uses
columns.title
to build the header. Instead you will need to build the header yourself before initializing Datatables.http://live.datatables.net/huyexejo/1/edit
Kevin