Incluido select en buscador

This commit is contained in:
imnavajas
2024-02-23 13:58:57 +01:00
parent 88dca50aaf
commit ed993deb12
2 changed files with 21 additions and 2 deletions

View File

@ -110,6 +110,25 @@ $('#tableOfPresupuestos thead tr:eq(1) th').each(function (i) {
});
}
else if (i == 2) {
// Agregar un selector en la tercera columna
$(this).html('<select class="form-control" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>');
// Agregar opciones al selector
var selector = $('select', this);
selector.append('<option value=""></option>'); // Opción vacía
// Agregar más opciones según tus necesidades
selector.append('<option value="libroFresadoTapaBlanda">libroFresadoTapaBlanda</option>');
selector.append('<option value="libroFresadoTapaDura">Fresado Tapa Dura</option>');
selector.on('change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
console.log(val)
theTable.column(i).search(val ? '^' + val + '$' : '', true, false).draw();
});
}
else{
$(this).html('<input type="text" class="form-control " style="min-width:100px;max-width:120px;font-size:0.8rem !important;" />');
@ -140,7 +159,7 @@ theTable = $('#tableOfPresupuestos').DataTable({
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 50,
lengthChange: true,
"dom": 'lBrtip',
"dom": '<"mb-3"l>Brtip',
"buttons": [
'colvis', 'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',

View File

@ -140,7 +140,7 @@ theTable = $('#tableOfPresupuestos').DataTable({
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 50,
lengthChange: true,
"dom": 'lBrtip',
"dom": '<"mb-3"l>Brtip',
"buttons": [
'colvis', 'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',