bug with table in table ?

bug with table in table ?

grobobgrobob Posts: 13Questions: 0Answers: 0
edited March 2009 in Bug reports
i want to use dataTable on a table which contain hidden table in each row like this :



...



...
...
subdata...


...
...
subdata...




Seem to not work. (1.5 beta 5)

Any idea ?

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Hi grobob,

    It should work. I've just tried a test with nested tables and it seems to do the job okay. Do you have a link you could post showing the error?

    Thanks
    Allan
  • grobobgrobob Posts: 13Questions: 0Answers: 0
    edited March 2009
    i've made this test case quickly, i hope it's not bugged
    http://lotro.fr/bdd/test
    I got an error, so i suppose i'm doing something wrong (i have no js error on the true url... but more complex)
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Hi grobob,

    Thanks very much for the link. Makes debugging much easier! The issue was in the selectors that I use for tbody, and that your tables use a tbody element. The two were getting mixed together, which resulted in a very confused DataTables... I've fixed this in my development version which I'll be releasing as beta 6 shortly.

    Allan
  • grobobgrobob Posts: 13Questions: 0Answers: 0
    ok, i removed tbody in the test url, same problem :(
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Try using beta 6 - I've modified the selectors a bit and hopefully this will fix your issue.

    Allan
  • grobobgrobob Posts: 13Questions: 0Answers: 0
    perferct ! thanks :)
  • lzamoralzamora Posts: 3Questions: 0Answers: 0
    Hi Allan,
    Wonderful, wonderful, wonderful plugin! Thanks very much, sir.

    I am trying to show a table within a table, and the inner table currently contains both a thead and a tbody tag. It seems to break if the thead tag contains th tags, with the following error:
    Error: oSettings.aoColumns[iIndex] is undefined
    Source File: jquery.dataTables.min.js
    Line: 411

    I can prevent the error by using td tags in place of the th tags.

    Is there a remedy for this conflict that would allow me to use th tags in the table-within-a-table, or am I forbidden from having additional th tags anywhere?

    snippet:
    [code]
    ...




    Name




    Luis Zamora




    ...
    [/code]

    Thank you,
    -Luis
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Hi Luis,

    Excellent catch - thank you for finding that bug. The problem was in the calculation algorithm used for determining the width of the column. bAutoWidth:false would get around this problem! I've got a fix, and it will be in the next release of DataTables. If you want to stick it into your local copy replace line 3755 ( "var oNodes = $("td", nCalcTmp);") with:

    [code]
    var oNodes = $("tr:eq(0)>td", nCalcTmp);
    [/code]
    And that should do the trick nicely.

    I've also taken the opportunity to put a couple of other checks in for inner tables, to make sure they don't confuse DataTables :-)

    Regards,
    Allan
  • lzamoralzamora Posts: 3Questions: 0Answers: 0
    "And that should do the trick nicely." Indeed it does!

    Thank you kindly,
    -Luis
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    A minor correction here actually :-)

    It should be:

    [code]
    var oNodes = $("tr:eq(1)>td", nCalcTmp);
    [/code]
    Otherwise the auto width calculation goes out the window...

    Allan
This discussion has been closed.