【问题标题】:How to make Jquery datatable work on 'n' number of columns?如何使 Jquery 数据表在“n”列上工作?
【发布时间】:2020-11-01 07:05:25
【问题描述】:

我正在制作 Django 网络应用程序。我在其中使用了这个datatable。我的页面中有四个数据表。他们都在工作,但在确定的列数上说 6。当我插入第 7 列时,搜索和分页从该表中消失。 我很困惑这个问题是特定于数据表还是其他问题。

在下面给出的这段代码中,分页和搜索消失了,但是当我删除最后一列和最后一列数据时,它会出现。

  <table id="confirmedDeliveries" class="ui celled table responsive nowrap unstackable" style="width:100%">
                    <thead>
                        <tr>
                            <th>Requested By</th> 
                            <th>Contact</th>                            
                            <th>Date Requested</th>
                            <th>From</th>
                            <th>To</th>    
                            <th>Required Delivery Date</th> 
                            <th align="center" colspan="2">Action</th>    
                        </tr>
                    </thead>
                    <tbody  class="new_requests">
                        {% for delivery in confirmed %} 
                        <tr>
                            <td>{{delivery.request.user}}</td>  
                            <td>{{delivery.request.contact}}</td>                             
                            <td>{{delivery.request.date_requested}}</td>
                            <td>{{delivery.request.from_address}}</td>
                            <td>{{delivery.request.to_address}}</td>
                            <td>{{delivery.request.required_delivery_date}}</td>
                            <td><button class="btn btn-danger btn-sm" id="cancel_request" data-id="{{delivery.id}}">Cancel</button></td>
                            <td><button class="btn btn-info btn-sm" id="done_request" data-id="{{delivery.id}}">Delivered</button></td>

                        </tr>
                        {% endfor %}
                    </tbody>
                </table>

任何见解都将是可观的。

【问题讨论】:

    标签: jquery django datatables


    【解决方案1】:

    尝试删除您的 colspan="2" - 所以,改用这个:&lt;th align="center"&gt;Action&lt;/th&gt;

    如果您想使用 colspans 和 rowspans,请参阅 this example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-17
      • 1970-01-01
      • 2017-01-14
      • 2018-02-14
      相关资源
      最近更新 更多