Uncaught TypeError: Cannot read property 'style' of undefined while using colspan

Uncaught TypeError: Cannot read property 'style' of undefined while using colspan

narayanang27narayanang27 Posts: 1Questions: 0Answers: 0
edited March 2014 in DataTables 1.9
[code]
<!DOCTYPE HTML>

















Engine
Browser
Platform
Version
Grade




Engine1
sub - engine1
Browser1
Platform1
Version1
Grade1










[/code]

after applying datatable plugin for the above table (colspan used table) it gives an error
[quote] Uncaught TypeError: Cannot read property 'style' of undefined in line no.3255 (line mentioned below) [/quote]

[code]
nThs[i].style.width = o.aoColumns[iVis].sWidth;
[/code]

I applied a validation line for that like

[code]
if(nThs[i] !== undefined)
nThs[i].style.width = o.aoColumns[iVis].sWidth;
[/code]

and it works fine!!!!

[quote] Is that ok Alan? If so please recommend it to others to use [/quote]

Replies

  • mesmithmesmith Posts: 1Questions: 0Answers: 0
    I had the same problem and can confirm that the above fix seems to work fine.
  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    I'm afraid that is not a complete solution. DataTables requires each column to have a unique cell in the header. This _must_ be the case in DataTables at the moment as it needs to be able to address each column individually - for string and filtering. Relaxing this constraint (it is a long term goal) will require some fairly invasive code.

    Allan
This discussion has been closed.