I'm having a difficult time implementing server-side processing with individual column searches. From my understanding, the value to search on for each column should be accessed in POST using columns[i][search][value], but I'm unsure how to set that variable.
I'm using MVC (CakePHP). I have a script implemented in my controller that returns the properly encoded data, when I use a hard-coded value (as opposed to the one that I want to be passed in from the view). Since I can get and encode data and it shows up in my table, I doubt that my table or script are part of the problem at this point.
Here is a link to the debugger output: http://debug.datatables.net/ofaqik
Here is my js:
$(function(){
var table = $("#departureTable").DataTable({
'serverSide': true,
'ajax' : {
"url" : '/CustomersDepartures/filterData',
"type" : 'POST',
"columns" : [
{"name": "product_type"}
]
}
});
$("#column1_search").on ('change', function(){
table.column('product_type')
.search($(this).val())
.draw();
});
});
$("#column1_search") refers to the following select input:
<select name="data[Product][product_type]" id="column1_search">
<option value=""></option>
<option value="1">Bicycle Tours</option>
<option value="2">Walking and Hiking Tours</option>
</select>
(I have no idea why newlines aren't coming through in my code.... sorry about that. :/)
Should the search value be passed as a POST variable and if so, how do I set it in my view?