Add custom Filter for server side Processing
Add custom Filter for server side Processing
Hello,
I have an question about how I can perform the Ajax request of DataTables with a custom Button. So that a user can write in some HTML input fields some keywords and maybe set a Value from a HTML select input field. Then he press the apply button and the settee filter values will be added to the request and then the Ajax request will be performed and I can access this custom values on the server side for a custom query string for the database to get the data filtered by the custom values. I read that I can append values to the request with the following code sequence passed to the DataTable initialization as json:
"ajax" : {
url : bdbops.ajax.url,
data : function(d){
d.action = bdbops.ajax.action;
d.filterRequestNumber = $('#filter_requestNumber').val();
d.filter_requestDate = $('#filter_requestDate').val();
d.filter_requestAuthority = $('#filter_requestAuthority').val();
d.filter_requestTitle = $('#filter_requestTitle').val();
}
},
But I didn't read how I can append Data from an Textfield and perform than the ajax request with a custom button. And also hold this filter values for the next ajax request for example when the user clicks on the net side Button. Someone an idea how to get this done?
Answers
You should call
table.draw();
once submit button is clicked. That will automatically call data function for you...