Two Tables one responsively paginated one not
Two Tables one responsively paginated one not
wbyers
Posts: 48Questions: 12Answers: 1
Does anyone now how to resolve this: I'm working on a page with two tables on it. One works perfectly. and the other never paginates or even changes with the pagination dropdown. They have the same starting settings so why is one an issue and the other not?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Would need to see your code. Here is an example of multiple tables on a page.
Kevin
Will you accept a snapshot of it. or would you prefer quoted code?:
"
<
div class="content content-boxed">
And the initialization javascript for both is
$(document).ready(function() {
<script> $('#programs').DataTable( {
"lengthMenu": [[10, 25, 50, 100, 250], [10, 25, 50, 100, 250]]
} );
} );
$(document).ready(function() {
$('#programs2').DataTable( {
"lengthMenu": [[10, 25, 50, 100, 250], [10, 25, 50, 100, 250]]
} );
} );
</script>
The best option is to link to a page showing the issue. If you can't provide a link to your page then maybe you can copy the relevant pieces into http://live.datatables.net/ or https://jsfiddle.net/ for troubleshooting.
If you can't do any of those then paste the code into the thread using triple back ticks (```) around the code as noted just below the "post Comment" button.
Kevin
Also the page is: http://usasportgroup.com/dev/admin/usg-teamtraining.php
Your second table has two < tbody > sections. DataTables doesn't accept that.
okay, thanks. would you have any recommendations?
Your loop PHP file is creating the multiple
tbody
tags:I don't know much about PHP but you need to change the loop building program2.
Kevin
So like tangerine said, Datatables doesn't handle multiple body tags? Can I get away with just using two if I change the loop? is there any way that datatables can be made to handle a double body table?
This post is a couple years old but according to Allan multiple tbody tags are not supported:
https://datatables.net/forums/discussion/29432
Kevin
so as far as anyone knows, it's not possible?
Do the developers still come on?
Kevin and @tangerine are correct - DataTables does not support tables with multiple
tbody
elements.Perhaps one option would be to move the row that you are using as a grouping header from the
tbody
into thethead
? DataTables does support multiple rows in thethead
.I had a look at the link, but I only see one table on it at the moment.
Allan
Thank you. It's been taken care of. We had to restructure it before the table we chose to go with, that you now see in the link, would work properly