[英]Dynamic table with pagination and Search
我有一個動態表,僅顯示10條記錄,並使用分頁顯示接下來的10條記錄。 我想要一個搜索功能。 我遵循此指南http://www.vonloesch.de/node/23但我只能搜索前10條記錄。
任何幫助表示贊賞。 謝謝
此函數將根據每一行的內容而不是您提供的鏈接中的一個單元格來過濾整個表的行。
// text => the text to search for
// _id => id of table to filter
// noOfHeaderRows => number of header rows :)
function filterTable( text, _id, noOfHeaderRows ) {
var table = document.getElementById( _id ), contents, row;
for (var r = noOfHeaderRows; r < table.rows.length; r++){
row = table.rows[r];
contents = row.textContent || row.innerText;
contents = contents.toUpperCase();
text = text.toUpperCase();
if( contents.indexOf( text ) > -1 ) {
row.style.display = "";
} else {
row.style.display = "none";
}
}
}
在這里擺弄
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.