Individual column filtering
Individual column filtering
I am using server side processing and I am unable to get individual column filtering to work. Normal filtering works fine when value is passed in sSearch. But when I add the column parameter to fnFilter, I confirm it is populating sSearch_1, but the table does not get filtered. Also, note that I am using CakePHP and the datatable plugin (https://github.com/cnizzdotcom/cakephp-datatable). Below is my code.
$(document).ready(function() {
var oTable = $('#addProspect').dataTable({
"iDisplayLength": 10,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "UserProspects/add",
"sDom": 'CRTrtip',
"oLanguage": {"sInfoFiltered": ""},
"aoColumns":[
null,
null,
null,
null,
null,
null,
{bSortable: false, bSearchable: false},
],
"fnCreatedRow": function(nRow, aData, iDataIndex){
$('td:eq(6)', nRow).html('Add');
}
});
//filter association
$('select#association').change( function() { oTable.fnFilter( $(this).val(), 1); } );
//filter major
$('select#major').change( function() { oTable.fnFilter( $(this).val(), 2); } );
//filter fraternity
$('select#fraternity').change( function() { oTable.fnFilter( $(this).val(), 3); } );
});
$(document).ready(function() {
var oTable = $('#addProspect').dataTable({
"iDisplayLength": 10,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "UserProspects/add",
"sDom": 'CRTrtip',
"oLanguage": {"sInfoFiltered": ""},
"aoColumns":[
null,
null,
null,
null,
null,
null,
{bSortable: false, bSearchable: false},
],
"fnCreatedRow": function(nRow, aData, iDataIndex){
$('td:eq(6)', nRow).html('Add');
}
});
//filter association
$('select#association').change( function() { oTable.fnFilter( $(this).val(), 1); } );
//filter major
$('select#major').change( function() { oTable.fnFilter( $(this).val(), 2); } );
//filter fraternity
$('select#fraternity').change( function() { oTable.fnFilter( $(this).val(), 3); } );
});
This discussion has been closed.
Replies
when first loaded: idinuj
when trying to filter 2nd column: eqaxet
I created a similar test case on the live server and it worked fine... http://live.datatables.net/alalay/