table.columns 不是 datatable.js 中的函数 [英] table.columns is not a function in datatable.js
本文介绍了table.columns 不是 datatable.js 中的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<script>
jQuery(document).ready(function () {
$('#sample_3 tfoot th').each(function () {
var title = $('#sample_3 thead th').eq($(this).index()).text();
$(this).html('<input type="text" placeholder="Search ' + title + '" />');
});
// DataTable
var table = $('#sample_3').dataTable();
// Apply the filter
table.columns().eq(0).each(function (colIdx) {
$('input', table.column(colIdx).footer()).on('keyup change', function () {
table
.column(colIdx)
.search(this.value)
.draw();
});
});
});
</script>
我得到 table.columns 不是函数 js 错误,我不明白缺少什么.
I got table.columns is not a function js error , what is missing i am not understand.
来源:https://datatables.net/examples/api/multi_filter.html
推荐答案
尝试改变
var table = $('#sample_3').dataTable();
到
var table = $('#sample_3').DataTable();
... 即,将 DataTable()
大写.来源:https://datatables.net/manual/api#Accessing-the-API一个>
... that is, capitalize the DataTable()
. Source: https://datatables.net/manual/api#Accessing-the-API
这篇关于table.columns 不是 datatable.js 中的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文