请求的未知参数' 4'对于数据表中的第0行

时间:2015-04-20 15:56:43

标签: javascript html datatables

尝试使用jQuery DataTables库运行数据表时出现上述错误。

  

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

<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>

1 个答案:

答案 0 :(得分:1)

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

  

如果表格的colspan中有rowspantbody,DataTables不支持,则会出现此错误。

但是,DataTables完全支持表格标题中的colspanrowspan,假设每列至少有一个唯一<th>,请参阅DataTables complex header example了解详情。< / p>