This plugin requires material-plugins.css
and DataTables official CSS.
jQuery is also required.
Demo
Features
Compatible features
- Display
- Sort
- Dense
- Snackbar notification
- Pagination
- Row selection row
- Column sorting
- Responsive
- Search
Missing features
You can create an Issue if you need some extra styling.
Using DataTables
Import DataTables.net CSS (Bootstrap 4 version) before Material CSS.
Import material-plugins.css after Material CSS.
Import DataTables JS (Bootstrap 4 version) and its dependencies after Material JS.
Insert your HTML table. This one is declared via a JS array.
Override DataTables default parameters once.
Define your table array (or any type: HTML, JSON..).
Initialize plugin on your table element.
All parameters are detailed in official documentation.
That’s it.
Customization
Localization
Replace language
object translations of $.extend($.fn.dataTable.defaults...
for locale texts.
Remove search bar
Set dom
value to '<"data-table"rt<"bottom"Blip>>'
.
Set dom
value to '<"top"f><"data-table"rt<"bottom"lip>>'
.
Dense table
Add .table-sm
CSS class to your HTML table declaration in order to render table as dense layout.
Responsive
Resize this window in order to see the Responsive plugin in action.
Row selection
Click on a row to select this row.
All parameters are detailed in official documentation.