<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 is not a function js 错误,缺少什么我不明白。
来源 :https://datatables.net/examples/api/multi_filter.html https://datatables.net/examples/api/multi_filter.html
尝试改变
var table = $('#sample_3').dataTable();
to
var table = $('#sample_3').DataTable();
...也就是说,大写DataTable()
。来源:https://datatables.net/manual/api#Accessing-the-API https://datatables.net/manual/api#Accessing-the-API
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)