从未使用过Tabulator,只是下载了第4版。我阅读了快速入门和文档,但是在运行示例脚本时仅得到空白屏幕。我的途径是正确的,我可以运行其他javascript脚本,因此不确定出什么问题。我非常喜欢这种界面的想法,并会帮助我建立一个小型药房组织的网站,我对此表示支持。
这是我的html和脚本
<script>
//create Tabulator on DOM element with id "example-table"
var table = new Tabulator("#example-table", {
height:205, // set height of table (in CSS or here), this enables the Virtual DOM and improves render speed dramatically (can be any valid css height value)
layout:"fitColumns", //fit columns to width of table (optional)
columns:[ //Define Table Columns
{title:"Name", field:"name", width:150},
{title:"Age", field:"age", align:"left", formatter:"progress"},
{title:"Favourite Color", field:"col"},
{title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
],
rowClick:function(e, row){ //trigger an alert message when the row is clicked
alert("Row " + row.getData().id + " Clicked!!!!");
},
});
//define some sample data
var tabledata = [
{id:1, name:"Oli Bob", age:"12", col:"red", dob:""},
{id:2, name:"Mary May", age:"1", col:"blue", dob:"14/05/1982"},
{id:3, name:"Christine Lobowski", age:"42", col:"green", dob:"22/05/1982"},
{id:4, name:"Brendon Philips", age:"125", col:"orange", dob:"01/08/1980"},
{id:5, name:"Margret Marmajuke", age:"16", col:"yellow", dob:"31/01/1999"},
];
//load sample data into the table
table.setData(tabledata);
</script>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<title>Tabulator</title>
<link href="css/tabulator.min.css" rel="stylesheet" />
<script type="text/javascript" src="js/tabulator.min.js"></script>
</head>
<body>
<div id="example-table"></div>
</body>
</html>
我将不胜感激。
答案 0 :(得分:0)
您要将包含Tabulator构造函数的脚本标记放在哪里?它们应该在正文中的 示例表 div下。
在浏览器控制台中是否收到任何警告消息?