如何使用jQuery-KingTable插件? (示例似乎没有加载)

How to use the jQuery-KingTable plugin? (Example does not seem to load)

我正在寻找一个 jQuery table 插件,它具有过滤等多种功能,我正在使用 xampp.

我找到了 jQuery-KingTable 但是当我从 GitHub 下载示例并打开 index.html 我只能看到 table header 而没有数据行。

如何使用jQuery-KingTable插件?

这是因为示例正在尝试加载 server-side 数据。

jQuery-KingTable project already explains this here: Working Modes

在 index.html 的结尾附近,您会看到一行指定 url 属性。您可以改用 data 属性。

替换这个

url: "/api/colors",

有了这个

data: [
  {
    "name": "Absolute Zero",
    "color": "#0048BA",
    "red": "0%",
    "green": "28%",
    "blue": "73%",
    "hue": "217°",
    "hslSaturation": "100%",
    "hslLight": "37%",
    "hsvSaturation": "100%",
    "hsvValue": "73%"
  },
  {
    "name": "Acid green",
    "color": "#B0BF1A",
    "red": "69%",
    "green": "75%",
    "blue": "10%",
    "hue": "65°",
    "hslSaturation": "76%",
    "hslLight": "43%",
    "hsvSaturation": "86%",
    "hsvValue": "75%"
  }
],

以上是同一项目中文件 /servers/data/colors.json 的部分副本。

请阅读文档。