2 (empty) tables on the same page don't seem to work
2 (empty) tables on the same page don't seem to work
sbarre
Posts: 4Questions: 0Answers: 0
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!
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!
This discussion has been closed.
Replies
[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
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