Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can make a select option filter by month or date #2234

Closed
TranceDevCode opened this issue Nov 4, 2019 · 4 comments
Closed

How can make a select option filter by month or date #2234

TranceDevCode opened this issue Nov 4, 2019 · 4 comments

Comments

@TranceDevCode
Copy link

TranceDevCode commented Nov 4, 2019

Hello Yajra, thank for this pacage, i need a little help with my code... how can make a select option filter in the datatable... i found a example like this but is not working in my code....

image
https://datatables.net/examples/api/multi_filter_select.html

Code snippet of problem

<div class="tab-content" id="pills-tabContent">
    <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">
  
        <div class="table-responsive">
                    <table  id="gastocomun" class="table table-striped table-bordered table-condensed table-hover" style="width:100%">                
                        <thead>
                            <th>ID</th>
                            <th>Depto</th>
                            <th>$ Alicuota</th>
                            <th>G. Comun</th>
                            <th>Date</th>
                            <th width="95px">Acciones</th>                            
                        </thead>
                       
                    </table>
        </div>  
    </div>
@push('scripts')             
<script>
$(document).ready(function() {
        $datatable=$('#gastocomun').DataTable({
            "language":{
                "sProcessing":     "Procesando...",
                "sLengthMenu":     "Mostrar _MENU_ registros",
                "sZeroRecords":    "No se encontraron resultados",
                "sEmptyTable":     "Ningún dato disponible en esta tabla",
                "sInfo":           "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
                "sInfoEmpty":      "Mostrando registros del 0 al 0 de un total de 0 registros",
                "sInfoFiltered":   "(filtrado de un total de _MAX_ registros)",
                "sInfoPostFix":    "",
                "sSearch":         "Buscar:",
                "sUrl":            "",
                "sInfoThousands":  ",",
                "sLoadingRecords": "Cargando...",
                "oPaginate": {
                    "sFirst":    "Primero",
                    "sLast":     "Último",
                    "sNext":     "Siguiente",
                    "sPrevious": "Anterior"
                },
                "oAria": {
                    "sSortAscending":  ": Activar para ordenar la columna de manera ascendente",
                    "sSortDescending": ": Activar para ordenar la columna de manera descendente"
                }
            },
            processing: true,
            serverSide: true,  
            info: true,
            autoWidth: true,
            select: true,
            aLengthMenu: [
                [10, 25, 100, 300, 500, -1],
                [10, 25, 100, 300, 500, "Todos"]
                ],
            "ajax" :'getGastocomun',
            "columns": [
                {data: 'id', name: 'id'},
                {data: 'copropietario_id', name: 'copropietario_id'},
                {data: 'prorrateo', "render": $.fn.dataTable.render.number( ',', '.', 5, ) },
                {data: 'montogc', render: $.fn.dataTable.render.number('.', ',', 0, '$') },
                {data: 'date', name: 'date'},
                {data: 'btn'}
            ]
        });
}); 

</script>
@endpush

-->

System details

  • Operating System: Windows now, in production is Linux
  • PHP Version 7.0
  • Laravel Version 5.5
  • Laravel-Datatables Version 8.1
@yajra
Copy link
Owner

yajra commented Nov 13, 2019

Try checking this demo for some ref: https://datatables.yajrabox.com/fluent/custom-filter. Basically, you can add a custom form which you can use and data on the request. You can then filter on the server-side based on the inputs.

If you want it on footer though, the example you provided should be enough to guide you but you need some more jQuery / js adjustments for it to work.

@yajra yajra added the question label Nov 13, 2019
@thewebartisan7
Copy link

link broken https://datatables.yajrabox.com/fluent/custom-filter
like most of other docs.

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Mar 17, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants