svoydom/public/assets/js/data-table.js
2023-05-17 09:57:20 +03:00

30 lines
932 B
JavaScript
Executable File

// npm package: datatables.net-bs5
// github link: https://github.com/DataTables/Dist-DataTables-Bootstrap5
$(function() {
'use strict';
$(function() {
$('#dataTableExample').DataTable({
"aLengthMenu": [
[10, 30, 50, -1],
[10, 30, 50, "All"]
],
"iDisplayLength": 10,
"language": {
search: ""
}
});
$('#dataTableExample').each(function() {
var datatable = $(this);
// SEARCH - Add the placeholder for Search and Turn this into in-line form control
var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
search_input.attr('placeholder', 'Search');
search_input.removeClass('form-control-sm');
// LENGTH - Inline-Form control
var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
length_sel.removeClass('form-control-sm');
});
});
});