0

While bootstrap datetimepicker does work (https://eonasdan.github.io/bootstrap-datetimepicker/), my datatable does not filter. When I insert the dates manually without implementing datetimepicker, the datatable filter.

I have 4 fields that are to filter my datatables, namely, min/max (minimum ID number and maximum ID number) and fini/ffin (start date and finish date of when the record was created).

Min/max work fine and as expect.

Fini/ffini work fine when I do NOT attach datetimepicker to the field (eg I manually input the date like 2016-12-01 and 2016-12-01). When I attach the datatimepicker like below the they do NOT work:

$(document).ready(function() {
    var table = $('#mytable').DataTable( {
    dom: 'Bfrtip',
    buttons: [
        'copy', 'csv', 'excel', 'pdf', 'print', 'colvis'
    ],
         colReorder: true,
          keys: true,
     } ); 

     // add bootstrap datepicker.  If below is removed, 
     // it works if I manually insert the dates

     $("#fini").datetimepicker({
         format: 'YYYY-MM-DD'
     });

     $("#ffin").datetimepicker({
         format: 'YYYY-MM-DD'
     } );



     // Event listener to the two range filtering 
     // inputs to redraw on input
     $('#min, #max').keyup( function() {
         table.draw();
     } );

     $('#fini').keyup( function() { 
         table.draw(); 
     } );

     $('#ffin').keyup( function() { 
         table.draw(); 
     } );
} );
spreaderman
  • 918
  • 2
  • 10
  • 39

1 Answers1

0

I have created the js fiddle demo which retrieves data in the date range.

For more details please see:

I have applied the search to date column.you need to select date range it retrieves data from that range:

http://jsfiddle.net/dipakthoke07/evcfespn/96/

Dipak Thoke
  • 1,963
  • 11
  • 18
  • I like the look of this approach but think you might need to tweak it a bit as it's not working for me (UK based, so maybe that's the issue?). – annoyingmouse Jan 03 '17 at 07:50