Individual column filter not working

Individual column filter not working

sarveshvemanasarveshvemana Posts: 4Questions: 0Answers: 0
edited October 2013 in DataTables 1.9
Hi, I'm trying to implement individual column filter but it is showing error as
[code]
TypeError: $(...).dataTable(...).columnFilter is not a function

$('#jQueryInvoices').dataTable().columnFilter();
[/code]
My sample code is :
I tried it in two ways , first is
[code]
$(document).ready(function() {
$('#jQueryInvoices').dataTable().columnFilter();
});
[/code]
and second is
[code]
$("#jQueryInvoices").dataTable({
"bServerSide": false,
"sAjaxSource":ajaxUrl,
"sAjaxDataProp": "ResultSet.aaData",
"bProcessing": true,
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bDestroy": true,
"sEcho": 1,
"iTotalRecords": 1,
"iTotalDisplayRecords": 10,
"aoColumns": [
{ "mDataProp": "controlNumber",sDefaultContent: "" },
{ "mDataProp": "runNumber",sDefaultContent: "" },
{ "mDataProp": "invoiceNumber" },
{ "mDataProp": "status" },
{ "mDataProp": "invoiceAmount" }
]
}).columnFilter();
[/code]
And included



Shall i mention any table footer?? I'm using data table 1.9 version. Please tell me the solution where i'm missing

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    I don't use ColumnFilterWidgets so I may be wrong, but I don't see you initialising sDom:
    "sDom": 'W<"clear">lfrtip'
  • sarveshvemanasarveshvemana Posts: 4Questions: 0Answers: 0
    As per the API, i read that .columnFilter() is an add on plugin. It is required to use sDom??
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    Look at the example in the docs.
  • harishraoharishrao Posts: 13Questions: 6Answers: 0
    edited May 2014

    Use this Code Works Fine

    $(document).ready(function () { $('#myDataTable tfoot th').each(function () { var title = $('#myDataTable thead th').eq($(this).index()).text(); $(this).html(''); }); var table = $('#myDataTable').dataTable().columnFilter(); $("#myDataTable tfoot input").on('keyup change', function () { table.column($(this.value).parent().index() + ':visible') .filter(this.value) .draw(); }); });
This discussion has been closed.