Getting started with datatable
Getting started with datatable
![yunis324](https://secure.gravatar.com/avatar/833c03cf6425313b5a0867e031421b1d/?default=https%3A%2F%2Fvanillicon.com%2F833c03cf6425313b5a0867e031421b1d_200.png&rating=g&size=120)
Good afternoon, I am learning to use datatable and I have a problem.
I want to add a condition to my table where the user can choose a date range and have it sorted in the table but I can't do it
Answers
function listar(){
tabla=$('#tbllistado').dataTable({
"bProcessing": true,//activamos el procedimiento del datatable
"bServerSide": true,//paginacion y filrado realizados por el server
dom: 'Bfrtip',//definimos los elementos del control de la tabla
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdf'
],
"ajax":
{
url:'../ajax/entrada_empresa.php?op=listar',
type: "get",
dataType : "json",
error:function(e){
console.log(e.responseText);
}
},
"bDestroy":true,
"iDisplayLength":10,//paginacion
"order":[[0,"desc"]]//ordenar (columna, orden)
}).DataTable();
}
Date range is documented here:
https://datatables.net/examples/plug-ins/range_filtering
Since you have server side processing enabled you will need to send the date range input values to the server using
ajax.data
as a function, like this example. Next you will need to update your server side script to incorporate the range parameters into the data query used to fetch the row data.Kevin