Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery制表器插件不工作_Javascript_Jquery_Html_Jquery Plugins - Fatal编程技术网

Javascript jQuery制表器插件不工作

Javascript jQuery制表器插件不工作,javascript,jquery,html,jquery-plugins,Javascript,Jquery,Html,Jquery Plugins,我想开始使用jQuery并实现一个交互式表来显示一些数据。我偶然发现了这个插件,它看起来很有前途,正是我所需要的 然而,当试图通过 我无法让演示表显示出来。诚然,我对整个JavaScript都是新手,但对我来说,似乎我正确地包含了库和脚本代码 我的HTML文件如下所示: <!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-3.2.1.js" integ

我想开始使用jQuery并实现一个交互式表来显示一些数据。我偶然发现了这个插件,它看起来很有前途,正是我所需要的

然而,当试图通过 我无法让演示表显示出来。诚然,我对整个JavaScript都是新手,但对我来说,似乎我正确地包含了库和脚本代码

我的HTML文件如下所示:

<!DOCTYPE html>
<html>
<head>
<script
  src="https://code.jquery.com/jquery-3.2.1.js"
  integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
  crossorigin="anonymous"></script>

<script
  src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"
  integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30="
  crossorigin="anonymous"></script>

<link href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/2.11.0/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/2.11.0/tabulator.min.js"></script>
</head>

<body>

<div id="exmaple-table"></div>

<script type="text/javascript">
$( function() {
  //create Tabulator on DOM element with id "example-table"
  $("#example-table").tabulator({
    height:"320px", 
    fitColumns:true, 
    columns:[ 
        {title:"Name", field:"name", sorter:"string", width:150},
        {title:"Age", field:"age", sorter:"number", align:"left", formatter:"progress"},
        {title:"Favourite Color", field:"col", sorter:"string", sortable:false},
        {title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
    ],
    rowClick:function(e, id, data, row){ 
        alert("Row " + 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
$("#example-table").tabulator("setData", tabledata);
});
</script>
</body>

</html>  

$(函数(){
//在id为“example table”的DOM元素上创建制表器
$(“#示例表”)。制表器({
高度:“320px”,
菲特:是的,
列:[
{标题:“名称”,字段:“名称”,分拣机:“字符串”,宽度:150},
{标题:“年龄”,字段:“年龄”,分类器:“编号”,对齐:“左”,格式化程序:“进度”},
{标题:“最喜欢的颜色”,字段:“col”,排序器:“string”,可排序:false},
{标题:“出生日期”,字段:“dob”,分拣机:“日期”,对齐:“中心”},
],
行单击:函数(e,id,数据,行){
警报(“行“+id+”已单击!!!!”);
},
});
//定义一些示例数据
var表格数据=[
{id:1,姓名:“奥利·鲍勃”,年龄:“12”,上校:“红色”,出生日期:},
{id:2,姓名:“玛丽·梅”,年龄:“1”,上校:“蓝色”,出生日期:“14/05/1982”},
{id:3,姓名:“克里斯蒂娜·洛博斯基”,年龄:“42”,上校:“格林”,国防部:“22/05/1982”},
{id:4,姓名:“Brendon Philips”,年龄:“125”,上校:“橙色”,出生日期:“1980年8月1日”},
{id:5,姓名:“Margret Marmajuke”,年龄:“16岁”,上校:“黄色”,出生日期:“31/01/1999”},
];
//将示例数据加载到表中
$(“#示例表”)。制表器(“setData”,tabledata);
});
从本质上讲,它只是从“快速入门”中复制粘贴的,但我使用CDN包含了这些库。我还包括
$(function(){..})
为确保在加载文档后对脚本部分进行评估

我的图书馆收录有什么问题吗?当我跟随链接时,我会得到相应的文件,所以我不认为这是错误的。还是我文件的结构?我将库包含在
中,并将实际脚本包含在
中。我还试图将身体的脚本部分外包出去,但也没有成功

因此:

  • 你能快速开始工作吗?如果可以的话
  • 我的代码有什么问题?
  • 这里输入错误


    它应该是
    示例表

    我的好上帝,我甚至仔细检查了那部分。。。非常感谢你。躲在角落里丢脸不用担心,你的帖子还是很有用的!