javascript - 如何使用带有 Angular 数据表错误的 ColumnFilter 或 LightColumnFilter b.dataTable.columnFilter 不是函数

标签 javascript jquery angularjs datatables angular-datatables

我想将 columnFilter 或 LightColumnFilter 与 Angular 数据表一起使用,但出现以下错误 b.dataTable.columnFilter is not a function

我知道在网站示例中https://l-lin.github.io/angular-datatables/#/withColumnFilter它表明你需要添加这些脚本

<script src="vendor/datatables-columnfilter/js/dataTables.columnFilter.js"></script>
<script src="vendor/angular-datatables/dist/plugins/columnfilter/angular-datatables.columnfilter.min.js"></script>

但由于这些示例是前一段时间制作的,我相信第一个脚本 dataTables.columnFilter.js 在以后的 jquery 数据表版本中不再可用

我正在使用 jquery Datatables 1.10.12

angular-datatables 0.5.5 and angularJs 1.5.7

这就是我创建表格的方式

vm.dtOptionsEstatus = DTOptionsBuilder.fromSource('data')
                    .withPaginationType('full_numbers')
                    .withOption('createdRow', createdRow)
                    .withOption('stateSave', true)
                    .withColumnFilter({
                        '0': {
                            type: 'text'
                        },
                        '1': {
                            type: 'text'
                        },
                        '2': {
                            type: 'text'
                        },
                        '3': {
                            type: 'text'
                        },
                        '4': {
                            type: 'text'
                        }
                    })
                    // Add Bootstrap compatibility
                    .withBootstrap()


    // Active Responsive plugin
//                        .withOption('responsive', true)
                        .withScroller()
//                        .withOption('scrollY', 100)
                        .withOption('scrollX', 200)
//                        .withOption('bFilter', false)
                        ;

最佳答案

我对使用 Bower 下载的库有疑问。使用以下链接下载的库解决了我的问题。

<script src="http://l-lin.github.io/angular-datatables/archives/vendor/datatables-light-columnfilter/dist/dataTables.lightColumnFilter.min.js"></script> <script src="http://l-lin.github.io/angular-datatables/archives/dist/plugins/light-columnfilter/angular-datatables.light-columnfilter.js"></script> 

更多信息https://github.com/l-lin/angular-datatables/issues/928

关于javascript - 如何使用带有 Angular 数据表错误的 ColumnFilter 或 LightColumnFilter b.dataTable.columnFilter 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38899046/

相关文章:

angularjs - visual studio 错误 :Unable to start debugging on the web server. 远程服务器返回错误:(403) Forbidden

for 中的 Javascript 动态事件

javascript - 使用js禁用文本输入中的数字输入

javascript - 使用 PhantomJS 在 Google Alert 中创建警报

javascript - AngularJS,如何在父级中使用子级的 JSON?

angularjs - SEO:Google 如何索引 Angular 应用程序 2016

javascript - 在javascript中创建类似 "new"的变量

javascript - 从设置间隔的文件中停止间隔

javascript - jquery自定义过滤器不起作用

jquery - 禁用 jQuery .toggle() 方法