【发布时间】:2020-02-05 02:37:24
【问题描述】:
我正在使用名为 Tabulator 的 jquery 插件,并尝试在所有列标题下方放置一个简单的文本框以过滤数据。似乎可以通过查看文档轻松完成,但这对我不起作用 链接:http://tabulator.info/examples/4.5?#filter-header
没有错误,但我根本看不到可以开始输入文本进行过滤的文本框
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://unpkg.com/tabulator-tables@4.5.3/dist/css/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.5.3/dist/js/tabulator.min.js"></script>
</head>
<body>
<div id="example-table"></div>
<script>
var tabledata = [
{id:1, name:"Billy Bob", age:12, gender:"male", height:95, col:"red", dob:"14/05/2010"},
{id:2, name:"Jenny Jane", age:42, gender:"female", height:142, col:"blue", dob:"30/07/1954"},
{id:3, name:"Steve McAlistaire", age:35, gender:"male", height:176, col:"green", dob:"04/11/1982"},
];
//define table
var table = new Tabulator("#example-table", {
data:tabledata,
autoColumns:true,
layout:"fitColumns",
pagination:"local", //enable local pagination.
paginationSize:2, // this option can take any positive integer value (default = 10)
columns:[
{title:"id", field:"id", headerFilter:"input"}, //never hide this column
{title:"name", field:"name",headerFilter:"input"},
{title:"age", field:"age",headerFilter:"input"}, //hide this column first
{title:"gender", field:"gender",headerFilter:"input"},
{title:"height", field:"height",headerFilter:"input"},
{title:"col", field:"col",headerFilter:"input"},
{title:"dob", field:"dob",headerFilter:"input"},
],
});
</script>
</body>
</html>
任何我可能做错的建议。
【问题讨论】:
标签: javascript jquery tabulator