Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
Save Save datepicker range in datatable

i'm using datatable with date range filter by using datepicker. When i set stateSave: true

it saves all values except the range set into the input datepicker field. Any help on this?

Have a look here: http://live.datatables.net/kajabeli/2/edit

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

DataTables has documented custom filters https://datatables.net/examples/plug-ins/range_filtering.html

That will filters age (similiar cases with yours)

$.fn.dataTable.ext.search.push(
    function( settings, data, dataIndex ) {
        var start_date = Date.parse($('#start_date').val()) / 1000 || 0;
        var end_date = Date.parse($('#end_date').val()) / 1000 || 0;
        var value = Date.parse(data[5]) / 1000 || 0;
        /* put your filter conditions here,  */
        if ( ( start_date && end_date ) ||
            ( start_date && value <= end_date ) ||
            ( start_date <= value && end_date ) ||
            ( start_date <= value && value <= end_date ) )
        {
            return true;
        }
        return false;
    }
);

Add below codes after your dataTable initiation.

$('#start_date, #start_date').change( function() {
    table.draw();
} );
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda