Custom search on server side processing
Custom search on server side processing
jerry_inc
Posts: 3Questions: 1Answers: 0
Hi, I am trying to implement a custom search, and data is coming via ajax but having some trouble...
this is my code
dataTableVar = $('#example').DataTable({
"serverSide": true,
"processing": true,
"searching": true,
"dom": '<"recordsFilterDD"><"dtTop"Bp>rt<"clear">',
"pageLength": DEFAULT_PAGE_LENGTH,
"ajax": {
"url": "?g=session_data_ajax",
"type": "POST"
},
"language" : {....}, // reduced code
"buttons": [{....}] // reduced code
});
I want to search only on two columns and I am not using default search. so I am getting search keyword from custom input box. I can search on one column like this...
dataTableVar.columns(2).search.(this.value).draw();
How can I search multiple columns?
If I try the following code, it doesn't work...
$.fn.dataTable.ext.search.push(
function (settings, data, dataIndex) {
console.log("This code Worked!");
}
);
I also tried this... but it also didn't work
$.fn.dataTableExt.afnFiltering.push(
function (oSettings, aData, iDataIndex) {
console.log("This code Worked!");
}
);
This discussion has been closed.
Answers
Let me explain some more....
The user will enter search keywords like this...
so I want to search
I have solved it.
Solution is following
This will search only in two Columns. with AND operator