【问题标题】:Requested unknown parameter '4' for row 0 in datatable为数据表中的第 0 行请求未知参数“4”
【发布时间】:2015-04-20 15:56:42
【问题描述】:

我在尝试使用 jQuery DataTables 库运行数据表时遇到上述错误。

请求第 0 行的未知参数“4”。

<div class="container">
<%= render :partial => "layouts/society_nav" %>
<div align="center">
        <h3>Self Help Groups</h3>
</div>
        <%=link_to "New Self Help Groups" ,new_admin_self_help_group_path,:class=>"btn btn-primary btn-new"%>

<table class="datatable table-bordered"> 
    <thead>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
        <th></th>
    </thead>

    <tbody>
        <% @selfhelp.each do |s|  %>
        <tr>
            <td class="thead">No of SHGS</td>
            <td colspan="2"><%= s.no_of_shgs %></td>
            <td> <%= link_to "<span class='glyphicon glyphicon-edit'></span>".html_safe,  edit_admin_self_help_group_path(s) %>
            </td>
            <td> <%= link_to "<span class='glyphicon glyphicon-trash'></span>".html_safe,  admin_self_help_group_path(s), :method => :delete, :title => "Delete?", "data-confirm" => "Do you really want to delete?" %>
            </td>
        </tr>
        <tr>
            <td class="thead">Out of which No of Women SHG</td>
            <td colspan="2"><%= s.no_of_women_shgs %></td>
            <td> <%= link_to "<span class='glyphicon glyphicon-edit'></span>".html_safe,  edit_admin_self_help_group_path(s) %>
            </td>
            <td> <%= link_to "<span class='glyphicon glyphicon-trash'></span>".html_safe,  admin_self_help_group_path(s), :method => :delete, :title => "Delete?", "data-confirm" => "Do you really want to delete?" %> 
            </td>
        </tr>
        <% end %>
    </tbody>
</table>

【问题讨论】:

    标签: javascript html datatables


    【解决方案1】:

    DataTables 库不支持表体中的colspan,请参阅this tech note

    如果表的tbody 中存在colspanrowspan,可能会出现此错误,DataTables 不支持。

    不过,DataTables 完全支持表头中的colspanrowspan,假设每列至少有一个唯一的&lt;th&gt;,请参阅DataTables complex header example 了解更多详细信息。

    【讨论】:

      猜你喜欢
      • 2014-09-16
      • 2019-01-28
      • 1970-01-01
      • 1970-01-01
      • 2015-12-15
      • 1970-01-01
      • 2015-08-30
      • 2018-04-20
      • 1970-01-01
      相关资源
      最近更新 更多