Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 获取使用DataTables的columnFilter插件_Jquery_Twitter Bootstrap 3_Datatables_Datatables 1.10 - Fatal编程技术网

Jquery 获取使用DataTables的columnFilter插件

Jquery 获取使用DataTables的columnFilter插件,jquery,twitter-bootstrap-3,datatables,datatables-1.10,Jquery,Twitter Bootstrap 3,Datatables,Datatables 1.10,我使用的是1.10.2 DataTables,我想利用columnFilter插件,而不是手动组装一些东西。我将引导呈现程序与datatables、jQuery1.10.2、jQueryUI1.10.3和引导3.1.1一起使用。这个特殊的表不使用任何花哨的东西(没有固定的标题,没有固定的列,没有ColVis或ColReorder)。分页已打开 <link rel="stylesheet" type="text/css" href="~/CSS/dataTables.bootstrap.cs

我使用的是1.10.2 DataTables,我想利用columnFilter插件,而不是手动组装一些东西。我将引导呈现程序与datatables、jQuery1.10.2、jQueryUI1.10.3和引导3.1.1一起使用。这个特殊的表不使用任何花哨的东西(没有固定的标题,没有固定的列,没有ColVis或ColReorder)。分页已打开

<link rel="stylesheet" type="text/css" href="~/CSS/dataTables.bootstrap.css" />
<!-- stuff -->
<table id="reportTable" class="table table-condensed table-striped table-bordered">
    <thead>
    </thead>
    <tbody>
    </tbody>
</table>
<!-- stuff -->
<script type='text/javascript' src='~/Scripts/jquery.dataTables.js'></script>
<script type='text/javascript' src='~/Scripts/dataTables.bootstrap.js'></script>
<script type="text/javascript" src="~/Scripts/jquery.dataTables.columnFilter.js"></script>
这是一个有22列的表。 我注意到的第一件事是columnFilter示例只提到数据表的小写初始化,如:

$('#blabla').dataTable().columnFilter();
如果我说

vm.table = $('#reportTable').DataTable({
     ...
}).columnFilter();
vm.table = $('#reportTable').DataTable({
     ...
});
$('#reportTable').columnFilter();

"TypeError: oTable.fnSettings is not a function
if (!oTable.fnSettings().oFeatures.bFilter)"
vm.table = $('#reportTable').DataTable({
     ...
});
$('#reportTable').dataTable().columnFilter();
我长了一个大胖子

"TypeError: $(...).DataTable(...).columnFilter is not a function
 vm.table = $('#reportTable').DataTable({"
如果我说

vm.table = $('#reportTable').DataTable({
     ...
}).columnFilter();
vm.table = $('#reportTable').DataTable({
     ...
});
$('#reportTable').columnFilter();

"TypeError: oTable.fnSettings is not a function
if (!oTable.fnSettings().oFeatures.bFilter)"
vm.table = $('#reportTable').DataTable({
     ...
});
$('#reportTable').dataTable().columnFilter();
如果我说

vm.table = $('#reportTable').DataTable({
     ...
}).columnFilter();
vm.table = $('#reportTable').DataTable({
     ...
});
$('#reportTable').columnFilter();

"TypeError: oTable.fnSettings is not a function
if (!oTable.fnSettings().oFeatures.bFilter)"
vm.table = $('#reportTable').DataTable({
     ...
});
$('#reportTable').dataTable().columnFilter();
没有出现过滤器


我做错了什么?我应该如何初始化它?

我不认为您可以将
columnFilter
应用于新的“D”数据表api,因为与返回jQuery对象的
.dataTable()
调用不同,新的
.dataTable
调用返回一个
对象

您可以修补
列过滤器
,以支持新的“D”api

使用my向列中添加筛选器

请注意,yadcf支持datatable的新旧api,它有10种不同类型的过滤器和成吨的其他优点:)


你能给我一些关于修补columnFilter的说明吗?我也在考虑你的插件,但我看到的所有示例都使用了旧的dataTables()调用。它能与新的DataTables()一起工作吗?从上一个示例(多个AJAX)中得到了它。我必须做:
vm.table=$('#reportTable').DataTable({…});init(vm.table,{…})
加上GitHub自述文件还显示了大写字母D的初始化注意showcase中每个页面底部的代码段,其中有一条关于API用法和在哪里可以找到它的注释。。。还可以查看文档(在js文件中)以查看所有yadcf特性