Error: TypeError: undefined is not an object (evaluating 'col.mData')

Error: TypeError: undefined is not an object (evaluating 'col.mData')

protomeprotome Posts: 25Questions: 11Answers: 1

Hello

I have this simple table, modified from the example in data tables (https://datatables.net/examples/basic_init/complex_header.html)
I simplified it to get closer to the one I wanted. Now I do not understand what is happening . My jsfiddle is at https://jsfiddle.net/prtome/jphw66fr/3/

the error is : TypeError: undefined is not an object (evaluating 'col.mData')

if I modify the headers as follows, it works

    <th colspan="2">Position</th>
            <th >Salary</th>
            <th >Salary</th>

I don't understand what is going on, since the more complex headers of the example have no problems!
Thanks for any pointer to where I am wrong
cheers

Answers

  • allanallan Posts: 64,788Questions: 1Answers: 10,726 Site admin

    You must have a unique header cell for each column. If you look in the example, there are two rows in the header, and between them, each column has a unique cell that can be clicked to sort the column. That's the issue with your own - the colspan makes that cell not unique to a column.

    Allan

This discussion has been closed.