I need to render entire table dynamically including multi level headers

I need to render entire table dynamically including multi level headers

25aravinth25aravinth 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

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    This example should help, it's demonstrating the use of rowspan and colspan within the header,

    Colin

  • 25aravinth25aravinth Posts: 2Questions: 0Answers: 0

    Hi Colin, thanks for your suggestion, but I could see only static content example, is there any reference for my use case?

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,735

    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

Sign In or Register to comment.