gpt4 book ai didi

javascript - table.columns 不是 datatable.js 中的函数

转载 作者:IT王子 更新时间:2023-10-29 03:10:37 24 4
gpt4 key购买 nike

<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

最佳答案

尝试改变

var table = $('#sample_3').dataTable();

var table = $('#sample_3').DataTable();

...也就是说,将DataTable() 大写。来源:https://datatables.net/manual/api#Accessing-the-API

关于javascript - table.columns 不是 datatable.js 中的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24325786/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com