Files
ByteCenter/public/js/pedidos/pedidoTableProveedor.js
2026-08-04 19:45:50 -03:00

58 lines
1.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
document.addEventListener('DOMContentLoaded', function () {
const table = $('#tablaProveedores').DataTable({
paging: true,
searching: true,
ordering: true,
pageLength: 7,
lengthChange: false,
info: true,
autoWidth: false,
columnDefs: [
{ orderable: false, targets: - 1 }
],
dom:
"<'row mb-3'<'col-md-8'f><'col-md-4 text-end'l>>" +
"<'row'<'col-12'tr>>" +
"<'row mt-3'<'col-md-5'i><'col-md-7'p>>",
language: {
search: "",
searchPlaceholder: "Buscar proveedores...",
zeroRecords: "No se encontraron proveedores",
info: "Mostrando _START_ a _END_ de _TOTAL_ proveedores",
infoEmpty: "No hay proveedores para mostrar",
infoFiltered: "(filtrado de _MAX_ proveedores totales)",
paginate: {
next: "",
previous: ""
}
}
});
// Insertamos el select al lado del buscador
$('.dataTables_filter')
.addClass('d-flex align-items-center gap-2')
.appendTo('#filtrosIzquierda');
$('#filtrosIzquierda').append($('#columnFilter'));
const searchInput = $('.dataTables_filter input');
$('#columnFilter').on('change', function () {
const colIndex = $(this).val();
table.search('').columns().search('').draw();
searchInput.off('keyup').on('keyup', function () {
if (colIndex === "") {
table.search(this.value).draw();
} else {
table.column(colIndex).search(this.value).draw();
}
});
});
});