fnFilter doesn't work in 1.10 with serverside processing
fnFilter doesn't work in 1.10 with serverside processing
odon
Posts: 2Questions: 1Answers: 0
Hi,
I have trying fnFilter in DataTables1.10 but it got an error in firebugs "TypeError: oTable.fnFilter is not a function", here is my code :
$(document).ready(function() {
var oTable = $('#example').DataTable( {
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$(nRow).attr({"onmouseover":"this.className='mouseover'", "onmouseout":"SetBackground(this,this.rowIndex);", "onclick" : "showEquip(" + aData[9] + ",\"<?php echo $sid;?>\");return false;"});
return nRow;
},
"oLanguage": {
"sSearch": "Search all columns:",
"sLengthMenu": 'Display <select style="margin-right:5px;"><option value="10">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option><option value="250">250</option><option value="-1">All</option></select>records…'
},
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": 'T<"clear"><"H"lr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "copy",
"mColumns": "visible"
},
{
"sExtends": "csv",
"mColumns": "visible"
},
{
"sExtends": "xls",
"mColumns": "visible"
},
{
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"mColumns": "visible"
},
"print"
]
},
"bSortClasses": false,
"iDisplayLength": 25,
"processing": true,
"serverSide": true,
"order": [[2, 'asc']],
"ajax": "modul/mod_equip/server_processing.php"
});
new $.fn.dataTable.FixedHeader( oTable );
$("#catId").change(function(){
oTable.fnFilter("^"+$(this).val()+"$", 10, true);
});
Can anybody help me with that error?
Thanks
This discussion has been closed.
Answers
Yes,
fnFilter
will work with 1.10, but you are using the$().DataTable()
construction which gives access to the new API, not the old one. See the second top FAQ.Allan
Thanks allan,
I have read again :
https://www.datatables.net/manual/api
and
https://datatables.net/reference/api/columns%28%29.search%28%29
and the conclusion i have found the answered :
and the select filter work like charm :)
need to read and read again manual, reference and new feature in 1.10 version.
great job allan, thanks