[英]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.