Datatables and Datepicker
Datatables and Datepicker
soporteaeh
Posts: 9Questions: 0Answers: 0
Hello friends, I have a problem with datatables and datepicker
in a table show the results of my database and show a calendar when I choose a calendar date results should be filtering, the problem is when I select a calendar date no longer filters the results
the code that I have is this
$.datepicker.regional['es'] = {
closeText: 'Cerrar',
prevText: '<Ant',
nextText: 'Sig>',
currentText: 'Hoy',
monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
monthNamesShort: ['Ene','Feb','Mar','Abr', 'May','Jun','Jul','Ago','Sep', 'Oct','Nov','Dic'],
dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'],
dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'],
weekHeader: 'Sm',
dateFormat: 'yy-mm-dd',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''
} ;
$.datepicker.setDefaults($.datepicker.regional['es']);
var oTable = $('#example').dataTable( {
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "server_processing.php",
"fnServerParams": function (aoData, fnCallback) {
/*aoData.push( {"name": "datepicker_min", "value": $('#datepicker_min').val() } );
aoData.push( {"name": "datepicker_max", "value": $('#datepicker_max').val() } );*/
aoData.push( {"name": "datepicker_min2", "value": $('#datepickercalendario').val() } );
aoData.push( {"name": "datepicker_max2", "value": $('#datepickercalendario').val() } );
},
"aaSorting": [[ 0, "desc" ]],
"oLanguage": {
"sLengthMenu": "Mostrando _MENU_ eventos por página",
"sZeroRecords": "No se encontro Nada - Disculpe",
"sInfo": "Mostrando _START_ de _END_ de un total de _TOTAL_ eventos",
"sInfoEmpty": "Mostrando 0 de 0 de un total de 0 eventos",
"sInfoFiltered": "(filtrados de _MAX_ total de eventos)",
"sSearch": "Buscar",
"oPaginate": {
"sFirst": "Primera",
"sLast": "Última",
"sNext": "Siguiente",
"sPrevious": "Anterior"
}
}
});
$( "#datepickercalendario" ).datepicker ( {
dateFormat: 'yy-mm-dd',
numberOfMonths: 1,
"onSelect": function(date) {
min = new Date(date).getTime();
max = new Date(date).getTime();
oTable.fnDraw();
}
})
.keyup( function () {
DateFilter = new Date(this.value).getTime();
DateFilter = new Date(this.value).getTime();
oTable.fnDraw();
});
$( "#datepicker_min" ).datepicker( {
} );
$( "#datepicker_max" ).datepicker( {
} );
This discussion has been closed.