merijn van der leek
asked on
bootstrap datatable
I wanna use a bootstrap data table but i cant get it to work.
this it the code in my header:
What line do i need to add to get bootstarp datatable since the one i have been using does not seem to work.
this it the code in my header:
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>>
What line do i need to add to get bootstarp datatable since the one i have been using does not seem to work.
Take a look at https://embed.plnkr.co/plu nk/vB1Gqe
Try adding this link in the header.
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>
You might want to show us the code you currently have.
Once you've included the datatables script and styles, you need to initialise the datatable, based on the ID of your table. In your scripts above, you've included the jquery datatables plugin. The bootstrap datatables plugin is a seperate package, so if you specifically want that, you'll also need to include it, as pointed out by Norie.
You initialise the table in your DOM ready block:
<table id="myTable">
...
</table>
Once you've included the datatables script and styles, you need to initialise the datatable, based on the ID of your table. In your scripts above, you've included the jquery datatables plugin. The bootstrap datatables plugin is a seperate package, so if you specifically want that, you'll also need to include it, as pointed out by Norie.
You initialise the table in your DOM ready block:
$(function() {
$('#myTable').DataTable();
});
The above code assumes your table has an ID of myTable<table id="myTable">
...
</table>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks everyone for the help!