Multiple tables on one page in two different Div.

Multiple tables on one page in two different Div.

BESLOBESLO Posts: 2Questions: 1Answers: 0

I want to put two completely different tables on one page. Following the examples on this site I tried to acomplish this but only table 1 is getting wrapped in datatable.

My first table hase this definition:
<table class="Projects table table-responsive table-striped table-bordered dataTable " id="pProjects">
The second:
<table class="Projects table table-responsive table-striped table-bordered dataTable " id="oProjects">

The script is:
$("#pProjects").DataTable(); $("#oProjects").DataTable();
I've also tried
$(document).ready(function() { $("table.Projects").DataTable(); } );

But can't get table 2 (oProjects) to also be wrapped in a Datatable div.

Both tables have a thead and tbody block.

Any idea's?

Answers

  • BESLOBESLO Posts: 2Questions: 1Answers: 0

    OK, found the problem after some more searching:
    Table 2 had two empty <th>'s (wanted them for buttons in table),
    This seems to be an issue with Datatable,
    Removing one empty <th> solves my problem.
    So I need to put multiple buttons for a row in one column instead of two.

  • kthorngrenkthorngren Posts: 21,260Questions: 26Answers: 4,934

    So I need to put multiple buttons for a row in one column instead of two.

    Datatables doesn't limit where you put buttons or how many columns have buttons. You need to define them within the Datatables init code. If you have defined more columns in your table than you have defined in Datatables then you will get errors which sounds like what you may have run into.

    Kevin

This discussion has been closed.