Adminlte: How to apply datatables in AdminLTE? Is it already built in or not?

Created on 30 Nov 2015  路  3Comments  路  Source: ColorlibHQ/AdminLTE

I am trying to apply the DataTables styling to my existing tables. I just want to check, is this functionality already built into the template and active, or do I need to manually include the DataTables CSS and JS files?

I can't see any reference to tables in the app or demo js files.

question

Most helpful comment

I meant other. No, identifier must be unique within a one page. If you use the ID, then each table must have a unique identifier is

<table id="example1" class="table table-bordered table-hover">

 </table>

<table id="example2" class="table table-bordered table-hover">

 </table>
 $(function () {
$("#example1, #example2").DataTable();
});

Or use class:

<table class="datatables">

 </table>
 $(function () {
$(".datatables").DataTable();
});

All 3 comments

For datatables need to connect the appropriate styles and scripts.
Example:

CSS file:

<link rel="stylesheet" href="../../plugins/datatables/dataTables.bootstrap.css">

JavaScript file:
<script src="../../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../../plugins/datatables/dataTables.bootstrap.min.js"></script>

For the table must specify an identifier.

<table id="example" class="table table-bordered table-hover">

 </table>

Use the function for the table:

<script>
 $(function () {
$("#example").DataTable();
});
</script>

So you mean all tables would need to have the same ID = example?

What about if there are two tables on the same page? I thought you weren't supposed to have more than one ID reference on a page?

I meant other. No, identifier must be unique within a one page. If you use the ID, then each table must have a unique identifier is

<table id="example1" class="table table-bordered table-hover">

 </table>

<table id="example2" class="table table-bordered table-hover">

 </table>
 $(function () {
$("#example1, #example2").DataTable();
});

Or use class:

<table class="datatables">

 </table>
 $(function () {
$(".datatables").DataTable();
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

lenamtl picture lenamtl  路  3Comments

vbetancourt picture vbetancourt  路  3Comments

riklaunim picture riklaunim  路  3Comments

noblemfd picture noblemfd  路  3Comments

gaea44 picture gaea44  路  3Comments