我正在用数据表构建一个 excel 过滤器。我收集了表行的值并将其推送到过滤器下拉列表中。
数据表代码:
datatable = $("#datatable").DataTable({
searching: true,
columns: [
{ title: "itemID", defaultContent: "" },
{ title: "Name", defaultContent: "" },
{ title: "Age", defaultContent: "" },
{ title: "Country", defaultContent: "" },
{ title: "E-mail", defaultContent: "" },
{ title: "Address", defaultContent: "" },
{ title: "Fax", defaultContent: "" },
{ title: "Employee ID", defaultContent: "" },
{ title: "Occupation", defaultContent: "" },
{ title: "Phone", defaultContent: "" },
{ title: "", defaultContent: "" }
],
// Initialize the datatable header.
initComplete: function () {
var table = this.api();
var headers = $(this[0]).find("thead tr").children();
// For each header, append an input so it can be used for filtering the table.
$(headers).each(
column =>
(table
.column(column)
// Append the filter div and the arrow down icon.
.header().innerHTML += `<i class="arrow down"></i><div class="filter"></div>`)
);
}
});
过滤表几次后,它停止过滤表。我很确定搜索数据表功能有问题,但我不明白确切的问题是什么(没有错误消息)。
如果有人可以提供帮助,我会很高兴。
谢谢你!
陪伴而非守候
相关分类