try this link https://datatables.net/reference/api/filter()
Nov 13, 2019
5
Level 1
Filter a data using Data table on click event.
My basic requirement is that when we click on the drop-down button select any value that will go to the data table. By which we can filter data from the controller.
#triptype it the id of the drop-down. #order it is the id for the table. Apart from this, we want to send one more variable that is which type filter you want to filter. In this way, what type of data is required for the user?
Here is the code
$('#tripType').change(function(e){
e.preventDefault();
var filtertables = $('#orders').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "ordersFilterAjaxData",
"columns": [
{ "data": "tripId" },
{ "data": "username" },
{ "data": "MTS" },
{ "data": "drivername" },
{ "data": "date" },
{ "data": "time" },
{ "data": "user_order_amount" },
{ "data": "user_order_pay_mode" },
{ "data": "user_order_status" },
{ "data": "rideStatus" },
{ "data": "Dvr" },
{ "data": "Serv" },
]
});
filtertables.destroy();
});
Please or to participate in this conversation.