Complex header question

Complex header question

CowsSayMooCowsSayMoo Posts: 2Questions: 0Answers: 0
edited August 2013 in DataTables 1.9
I am attempting to use the example found here: https://datatables.net/release-datatables/examples/basic_init/complex_header.html

The problem I am running into is that I want more than 2 columns before my colspan'd columns. My code looks like this

[code]


Column 1
Column 2
Column 3
Column 4
Column 5
ColSpan Column 6


Avg
Min
Max


[/code]

This should present a table with "Avg" "Min" and "Max" under the "ColSpan Column 6" header. Unfortunately, it throws a javascript error instead.

[code]
Error: TypeError: aLayout[(i + k)] is undefined
Source File: jquery.dataTables.js
Line: 1831
[/code]

I really want to be able to use multiple ColSpan groupings on the same table, but I can't even get one working when I have more than two rowspan columns. Am I doing something wrong?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    DataTables requires that each column must have at least one cell which is not colspan'ed. This is to allow column detection and for sorting to be applied to each individual column. There currently is no other option.

    I do want to relax this constraint, but it will make sorting not possible on any but the first column in the colspan section. Not sure when I'll get a chance to implement this though I'm afraid.

    Allan
  • CowsSayMooCowsSayMoo Posts: 2Questions: 0Answers: 0
    I'm not sure I am understanding. Each column needs one cell that isn't colspan'd? Wouldn't the example provided meet that criteria? I "ColSpan Column 6" has 3 cells that are not colspan'd.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Oops - missed that. in which case yes, your example should work just fine. Please link to a test case showing the issue.

    Allan
This discussion has been closed.