2 (empty) tables on the same page don't seem to work

2 (empty) tables on the same page don't seem to work

sbarresbarre Posts: 4Questions: 0Answers: 0
edited January 2012 in Bug reports
I'm running DataTables 1.9b2 and I am trying to initialize 2 tables on the same page, and when I do I get an error.

Note that if I put only one table on the page, everything works fine!

Here is my init code:

[code]
$(".data-tables").dataTable({
'bLengthChange' : false,
'iDisplayLength': 50,
'sPaginationType': "full_numbers"
});
[/code]

And my table(s) look like this:

[code]




Quantity
First Name
Last Name
Amount
Actions





[/code]

Note that my table may or may not begin empty. I don't populate via AJAX. So I am wondering if this is the problem? Although as I indicated there isn't any issue when the table is empty but there is only one per page.

Any help is appreciated!

Replies

  • sbarresbarre Posts: 4Questions: 0Answers: 0
    Oh and the error I get is an alert that says:

    [quote]
    DataTables warning (table id = '[tableid]'): Requested unknown parameter '1' from the data source for row 0
    [/quote]

    (The [tableid] bit is the generated ID for the table)

    And in the console I see:

    [quote]
    Uncaught TypeError: Cannot read property 'className' of undefined
    [/quote]

    From line 637 of jquery.dataTables.js
  • sbarresbarre Posts: 4Questions: 0Answers: 0
    edited January 2012
    Update: I've created 2 test pages where this problem can be reproduced:

    This first page shows 2 tables with at least one content row. You will see how the tables seem to be wrapped twice in the wrapper elements (and the configuration options don't get applied to the outer wrapper).

    https://office.osdh.ca/data-tables/index.html

    This example has an empty TBODY (no rows) and you will get the error I listed above.

    https://office.osdh.ca/data-tables/empty.html
  • sbarresbarre Posts: 4Questions: 0Answers: 0
    Aaand a final note that this appears to be a 1.9b2 problem because dropping in version 1.8.4 solves all the problems.
This discussion has been closed.