Please help me with filter input
Please help me with filter input
shadeoner
Posts: 7Questions: 1Answers: 0
Hello,
I have used 3hours trying to make works filters (like here http://datatables.net/examples/api/multi_filter.html )
Here it is my code :
$(document).ready(function(){
var table = $('.data-table').dataTable({
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "POST",
"sAjaxSource": "/ajax/establishments?franchise=0",
"bJQueryUI": true,
"aaSorting": [[ 0, "desc" ]],
"iDisplayLength": "50",
"sPaginationType": "full_numbers",
"oLanguage": {
"sProcessing": 'Chargement En Cours ...',
"sLengthMenu": "Afficher _MENU_ lignes",
"oPaginate": {
"sFirst" : " << ",
"sLast" : " >> ",
"sNext" : " > ",
"sPrevious" : " < "
},
"sZeroRecords": "Aucun Résultat",
"sInfo": "_END_ résultat(s) (_TOTAL_ au total)",
"sSearch" : "Recherche"
},
"aoColumns" : [
{ "mData" : "id", "bSortable": false},
{ "mData" : "name", "bSortable": false},
{ "mData" : "street", "bSortable": false},
{ "mData" : "city", "bSortable": false},
{ "mData" : "categoryName", "bSortable": false},
{ "mData" : "date", "bSortable" : false},
{ "mData" : "author", "bSortable": false},
{ "mData" : "menu", "bSortable": false},
{ "mData" : "photo", "bSortable": false},
{ "mData" : "scoreQualityInformation", "bSortable": false},
{ "mData" : "scoreRank", "bSortable": false},
{ "mData" : "status", "bSortable": false},
{ "mData" : "actions", "bSortable": false}
],
"sDom":'<""ilf>rt<"F"p>'
});
$(".data-table thead input").on( 'keyup change', function () {
table
.column( $(this).parent().index()+':visible' )
.search( this.value )
.draw();
} );
});
The datatables is well initialized, but since I try to type something in an input it does not work, and have this message in my console :
"Uncaught TypeError: undefined is not a function", on the line number of this : .column( $(this).parent().index()+':visible' )
Thank you very much for your help !
This discussion has been closed.
Answers
it's ok, I used filterColumn()
The second most popular (although it might soon claim the top spot I think) FAQ is the reason for this: http://datatables.net/faqs/#api
Allan
Hi Allan, thanks for this, maybe my english is not enought, but I rade many times forum or FAQ, I did not find anything
Change:
To
i.e. capital
D
as the FAQ states.Allan
ohhhhh Ok ...
Thank you Allan !
That's maybe fnDelay did not work too :p