Filter datatable yadcf插件初始化()不工作

Filter datatable yadcf插件初始化()不工作,filter,datatable,yadcf,Filter,Datatable,Yadcf,我正在使用带有bootstrap3的datatable。我想在点击按钮后应用过滤器。但当我点击按钮时,它给了我TypeError:oTable.settings不是一个函数错误。我的数据表版本是1.10.6,yadcf版本是0.8.7 这是我的密码 function init_datatable(table_id, records) { // console.log('init table',$.parseJSON(records)); var oTable = $(table_i

我正在使用带有bootstrap3的datatable。我想在点击按钮后应用过滤器。但当我点击按钮时,它给了我
TypeError:oTable.settings不是一个函数
错误。我的数据表版本是
1.10.6
,yadcf版本是
0.8.7
这是我的密码

function init_datatable(table_id, records) {
//    console.log('init table',$.parseJSON(records));
    var oTable = $(table_id).dataTable({
        aaData: $.parseJSON(records),
        "sPaginationType": "bootstrap",
        "bFilter": false,
        "bInfo": false,
        "sPageButtonActive": "active",
        "aaSorting": [[0, 'desc']],
        "bDeferRender": true,
        "sDom": '<"top"if>rt<"bottom"lp><"clear">',
        "aLengthMenu": [
            [10, 20, 30, 50, -1],
            [10, 20, 30, 50, "All"] // change per page values here
        ],
        "iDisplayLength": 10,
        "oLanguage": {
            "sEmptyTable": "No data available"
        },
        "aoColumnDefs": [{
                "aTargets": [0],
                "bVisible": false,
                "bSearchable": false
            },
            {
                "bSortable": false,
                "aTargets": [-1], // <-- gets last column and turns off sorting
                "mData": null,
                "mRender": function(data, type, full) {
                    return '<a data-original-title="Edit" id="edit_' + full[0] + '" data-placement="top" class="btn btn-xs btn-teal tooltips edit"  href="javascript:void(0)"><i class="fa fa-edit"></i> Edit</a>';
                }
            }]
    });
//            .yadcf([
//        {column_number: 1}
//    ]);
    $(table_id + '_wrapper .dataTables_length select').addClass("m-wrap");
    $(table_id + '_wrapper .dataTables_length select').select2();
    return oTable;
}

“init_datatble函数正在工作。但是当我使用init时,它会给我错误。init

yadcf。init
应该只用于大写为D的新API,因为您没有使用新API,所以应该使用以下方法初始化yadcf

$(table_id).dataTable({
    ......
}).yadcf([......]);
请参阅上的代码段中的注释


b、 t.w如果您想实用地过滤某个列,您应该使用

exFilterColumn
函数,

您仍然可以通过获取表引用来使用“yadcf.init”。以下是获取表引用的方法:

var api=newjquery.fn.dataTable.api(设置); var-oTable=api.table()

init(oTable,[{}])

$(table_id).dataTable({
    ......
}).yadcf([......]);
//----------------------------------------------
//Example on how to define a custom filter function
//this function is goinf to be passesd to yadcf as custom_func parameter value
//and going to be tested against each value in the column
//----------------------------------------------