Bootstrap 5 CSS not working when I use multiple tables on same page js => table.display

Bootstrap 5 CSS not working when I use multiple tables on same page js => table.display

hcanninghcanning Posts: 2Questions: 2Answers: 0

Hi,
If I use the js $('table.display').DataTable({ as per https://datatables.net/examples/basic_init/multiple_tables.html with bootstrap CSS (https://datatables.net/examples/styling/bootstrap5.html) the styling gets messed up.
Is there a Bootstrap 5 CSS file available that I could use with $('table.display').DataTable?
Thanks

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954
    edited January 2023

    $('table.display').DataTable({

    The display class is a class used by the default Datatables styling. See this doc for details. If you are using Bootstrap you will want to use bootstrap 5 table classes. Click on the HTML tab of the example you linked for an example.

    Assuming you remove the display class you will need to change your selector, ie, $('table.display'), to include all the desired tables.

    Kevin

Sign In or Register to comment.