Number and a date range filter for datatable serverside script

Number and a date range filter for datatable serverside script

CapamaniaCapamania Posts: 233Questions: 81Answers: 5

I'm using Datatable (DataTables 1.10.10) and Datatable Editor. For my serverside script/table (500000 rows) I would like to have a number and a date range filter. As simple text filter is working fine. Where and how can I modify the data.php for the range filter to work? That's my setup:

    <html>
         <input data-column="2" id="min" name="min" type="number" min="0" max="500000"> 
         <input data-column="2" id="max" name="max" type="number" min="0" max="500000">
    </html>

That's my script:

     var table = $('#my-table').DataTable( {
        dom: "Blfrtip",
        ajax: {
        url: "/data.php",
        type: "POST",
        data: function (d) { 
            d.minDate = $('#min').val(); 
            d.maxDate = $('#max').val(); } 
        },
    ...
    });

    $('#min, #max').keyup( function() {
        table.ajax.reload();
    }); 
This discussion has been closed.