server-side, th colspan > 1, added data...not match # of cols

server-side, th colspan > 1, added data...not match # of cols

mgmg Posts: 47Questions: 0Answers: 0
edited April 2011 in General
Using the server-side approach to fill the datatable,
I attempted to add a few to the .

Datatables came back with a warning: "Datatables warning (table id = "table-one"): Added data (size 10) does
not match known number of columns (8).

[code]



Head 1
Head 2
Head 3
Head 4
Head 5
Head 6
Head 7
Head 8




Loading data...



[/code]

Perhaps the forum or the documentation already contains a suitable answer,
but I failed to find it.

As a work-around, I've added a hidden to
the end of the table for each additional colspan.
It's important to place the hidden elements
at the end, so as to prevent any other column headers
look empty. Another drawback to this approach, which
I have to investigate further, is having to account
correctly for the column being sorted or searched:
sSearch_0, sSearch_1, etc. and other such
variables.

[code]



Head 1
Head 2
Head 3
Head 4
Head 5
Head 6
Head 7
Head 8






Loading data...



[/code]

It's kludgy, but I think it will fly.
If someone can point me in a better direction, though,
that would also be nice.

Replies

  • allanallan Posts: 63,520Questions: 1Answers: 10,473 Site admin
    DataTables requires at least one unique cell for each column. If you have colspans then you need another row with unique cells for those columns. Otherwise there is no way to sort on just one of the two columns which the column header is spanning over.

    Allan
This discussion has been closed.