fnGetPosition(cell) doesn't work with nested tables

fnGetPosition(cell) doesn't work with nested tables

lxslxs Posts: 2Questions: 0Answers: 0
edited July 2009 in Bug reports
I have a table that has tables inside the cells (in divs).

fnGetPosition doesn't work properly when called on any cell which comes after a cell with a table in it. fnGetPosition looks for all tds inside the cell's row and ends up getting the sub-table's cells mixed into the array. Instead it should be only looking for the tds which are direct children of the row.

I've worked around this by just using th for the sub-table's cells and re-styling them, but it would be nice to be able to use tds in sub-tables.

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Hi lxs,

    Good question, and I think I have an answer as well. If you have a look at the DataTables source code and find:

    [code]
    if ( oSettings.aoData[i].nTr.getElementsByTagName('td')[j-iCorrector] == nNode )
    [/code]
    and replace that with:

    [code]
    if ( $('>td', oSettings.aoData[i].nTr)[j-iCorrector] == nNode )
    [/code]
    does that fix it for you?

    Allan
  • lxslxs Posts: 2Questions: 0Answers: 0
    Seems to work for my tables. Thanks!
This discussion has been closed.