简体   繁体   English

如何指定数据表中的列数 jQuery 插件

[英]How to specify the number of columns in datatables jQuery plugin

I downloaded datatables jquery plugin, and I tried to reduce the number of columns from the default six我下载了数据表 jquery 插件,并尝试从默认的六列减少列数默认 to just four只有四个修改为 4 , from the html source code. , 来自 html 源代码。 After doing this, when I reload my page, it returned an error:这样做之后,当我重新加载我的页面时,它返回了一个错误: 在此处输入图片说明 . . How do I resolve this???我该如何解决这个问题???

I have checked datatables website, but I don't really understand how to get this fixed.我检查了数据表网站,但我真的不明白如何解决这个问题。 I'm a newbie in jQuery and this is my first time to use datatables plugin.我是 jQuery 的新手,这是我第一次使用数据表插件。

The problem in your code is that you are missing a < td > (line 248).您代码中的问题是您缺少 <td>(第 248 行)。

<tr>
  <td>Timothy Mooney</td>
  <td>here is the error</td>
  <td>37</td>
  <td>2008/12/11</td>
</tr>

Here is a working fiddle这是一个工作小提琴

You should check datatables documentation: https://www.datatables.net/manual/tech-notes/4您应该检查数据表文档: https : //www.datatables.net/manual/tech-notes/4

It explained there that它在那里解释说

DataTables warning: table id={id} - Requested unknown parameter '{parameter}' for row {row-index}, column{column-index}`数据表警告:表 id={id} - 为行 {row-index}、column{column-index}` 请求未知参数“{parameter}”

{id} is replaced with the DOM id of the table that has triggered the error {parameter} is the name of the data parameter DataTables is requesting {id} 替换为触发错误的表的 DOM id {parameter} 是 DataTables 请求的数据参数的名称

{row-index} is the DataTables internal row index (row().index()) for the row that has triggered the error. {row-index} 是触发错误的行的 DataTables 内部行索引 (row().index())。

{column-index} is the column data index (column().index()) for the column that has triggered the error. {column-index} 是触发错误的列的列数据索引 (column().index())。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM