我正在用數據表構建一個 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>`)? ? ? ? );? ? ? }? ? });過濾表幾次后,它停止過濾表。我很確定搜索數據表功能有問題,但我不明白確切的問題是什么(沒有錯誤消息)。如果有人可以提供幫助,我會很高興。謝謝你!
數據表搜索功能不會根據多個值過濾表
慕俠2389804
2023-06-15 16:11:56