收到错误我不明白使用 Smartadmin Bootstrap 数据表

Receiving error I don't understand using Smartadmin Bootstrap Datatables

您好,我正在尝试对使用 Perl 和模板工具包呈现的网页实施数据table。 我在呈现数据 table 时收到来自数据的弹出式错误

这是错误:

DataTables warning: table id=datatable_tabletools - Requested unknown                             
parameter '1' for row 1. For more information about this error, please see             
http://datatables.net/tn/4

我已阅读有关此错误的文档,但我仍然不确定为什么会收到此错误

这是我认为与之相关的代码。

              <table iq-datatable id="datatable_tabletools" class="table table-striped table-bordered table-hover render_me_as_datatable" width="100%">

                <thead>
                  <tr role="row">
                    <th class="sorting_asc">ID</th>
                    <th class="sorting">thing</th>
                    <th class="sorting">otherthing</th>
                    <th class="sorting">anotherthing</th>
                    <th class="sorting">morething</th>
                    <th class="sorting">something</th>
                    <th class="sorting"></th>
                  </tr>
                </thead>
                <tbody>
                  [% FOREACH item IN list%]
                  <tr role="row" class="odd [% item.var%]"
                   [% IF item.var== "CLOSED" %]
                      style="background-color: lightgreen;"
                    [% ELSE %]
                      style="background-color: lightyellow;"
                   [% END %]>
                    <td class="sorting_1">[% item.var%]</td>
                    <td>[% item.var1%]</td>
                    <td>[% item.var2%]</td>
                    <td>[% item.var3 FILTER currency %]</td>
                    <td>[% item.var4%]</td>
                    <td>[% item.var5%]</td>
                    <td> <a href="#" onclick="edit([% item.var6%]);return false;"> <i class="fa fa-edit"></i> View </a> </td>
                  </tr>

错误中提供的文档,解释的很好https://datatables.net/manual/tech-notes/4

DataTables 中的每个单元格都请求数据,并且当 DataTables 尝试获取单元格的数据但无法这样做时,它会触发警告,告诉您数据在原来的位置不可用预计是

DataTables warning: table id={id} - Requested unknown parameter '{parameter}' for row {row-index}, column{column-index}`

其中: {id} 替换为触发错误 table 的 DOM id

{parameter} 是 DataTables 请求的数据参数的名称

{row-index} 是触发错误的行的 DataTables 内部行索引 (row().index()API)。

{column-index} 是触发错误的列的列数据索引 (column().index()API)。 DataTables 1.10.10 添加了列索引信息。

所以要分解它,DataTables 已请求给定行的数据,提供的 {parameter} 但那里没有数据,或者它为 null 或未定义(DataTables 不知道,默认情况下如何显示这些参数 - 如果您的数据确实包含这些值,请参阅下文)。

id 你的情况是 datatable_tabletools

parameter 你的情况是 1

row-index 你的情况是 row 1

最后,给你一个简短的回答,datatable_tabletools 中的 column 1 row 1 不包含它期望的数据,它要么是空的,要么是空的,要么是格式不正确。

因此请查看代码请求的内容,看看 table 中没有的内容。