Header ColSpan is not working for me

Header ColSpan is not working for me

ccadwellccadwell Posts: 2Questions: 1Answers: 0

Can anyone help I can't believe I found a bug with datatables I must be doing something wrong. I have posted a working example. http://live.datatables.net/dijoresu/1/
Seems on the initial load of the dom table paging and info doesn't display but if I click on one of the headers to sort the table they appear.

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    https://datatables.net/examples/basic_init/complex_header.html

    Look at the example. You're missing the "rowspan" for your "test" header.

  • ccadwellccadwell Posts: 2Questions: 1Answers: 0

    I didn't give a good example. What I was trying to do is have the first four headers to not display any headers since each row in the table body the first 4 <td> will have links within but for the example I just added blank <td> which showed the symptom.
    To correct I just dropped the colspan and and added 4 <th> instead and used the coldefs in the dom to eliminate column sorting for the first 4 columns.
    Here is and example of my fix http://live.datatables.net/bemaxawe/1/ not sure if this is the best way but it works.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    To correct I just dropped the colspan and and added 4 <th>

    This is the correct thing to do in DataTables. Each column must have a unique header cell (i.e. a cell that is attributed to only that column).

    This is a restriction that I hope to ease in future, but doing so will be fairly complicated!

    Allan

This discussion has been closed.