Can't get responsiveness to work on table

Can't get responsiveness to work on table

trustedsamuraitrustedsamurai Posts: 9Questions: 4Answers: 0

Hello,
On a previous table I've built (PHP output into html) I was able to get datatables working responsively. But on a new website that I'm building I can't get this to work.

I've checked all the settings on the new site and think I probably got lucky the first time round. When using Inspect I see that my (old) working site adds a class of 'collapsed' to the table where this doesn't happen with my new site.

My new site displays fine in datatables, with all of the formating, search bar, pagination etc. Here is the script that I think should work.

(function($) {
   var table = $('#fish_list').DataTable({
      responsive: true
    });

    table.responsive().rebuild();
  
}(jQuery));

The table itself can be inspected here: https://handfish.org.au/fish-list/

many thanks for any suggestions.

John.

Answers

  • colincolin Posts: 15,146Questions: 1Answers: 2,586

    Hi @trustedsamurai ,

    The problem is because you're not including the Responsive . If you look at this example here, ensure you have the necessary files listed on the Javascript and CSS tabs beneath the table.

    Cheers,

    Colin

This discussion has been closed.