Pure JavaScript (VanillaJS) component that transforms simple html tables, into fully-interactive and accessible datatables with sorting, searching and paging features.
To use the datatable plugins, two main file must be included. The stylesheet:
<link rel="stylesheet" href="/js-datatable/dist/css/datatable.min.css" />
And the script file (inclusive of all language files)
<script src="/js-datatable/dist/datatable.min.js"></script>
The table must be wrapped correcty as the following example
<table data-replace="jtable" data-search="true" data-locale="en">
<thead>
<tr>
<th>Name</th>
<th>Surname</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mario</td>
<td>Rossi</td>
<td>20</td>
</tr>
</tbody>
</table>
attribute name | data type | description |
---|---|---|
data-locale |
string |
lowercase two-letters ISO language code |
data-search |
boolean |
tells if table should be searchable |
At the time I'm writing this document, there are only Italian (it
) and English (en
) available.
I don't use automatic translators. I prefer filling only languages that I know.
Other translation can be easily added in the /src/locales.js
file.
Remeber to use the correct ISO two-letter code. See here