【问题标题】:jquery Datatable individual column filterjquery Datatable 单个列过滤器
【发布时间】:2012-06-22 07:43:53
【问题描述】:

我尝试使用 jquery 数据表的 columnFilter 插件,但无法使其运行。 我已经正确添加了插件,因为它没有引发任何错误,但它也没有在表格上创建过滤器/搜索字段。

数据表行由服务器端创建,第一列包含复选框。你可以在下面找到我的 html 和 jquery。

可能是什么问题?

<table id="orderList">
                <thead>
                    <tr>
                        <th><input type=checkbox name='allSelect' class="allSelect"></th>
                        <th> h1 </th>
                        <th> h2 </th>
                        <th> h3 </th>
                        <th> h4 </th>
                        <th> h5 </th>
                    </tr>
                </thead>
            </table>

var oTable = $('#orderList').dataTable(
                {
                    "sScrollY": "350px",
                    "sScrollX": "100%",
                    "bJQueryUI": true,
                    "sPaginationType": "full_numbers",
                    "bProcessing": true,
                    "bServerSide": true,
                    "sAjaxSource": "/project/order_search_ajax/",
                    "aoColumnDefs": [
                      { 'bSortable': false, 'aTargets': [ 0 ] }
                   ]
                }
        ).columnFilter();

【问题讨论】:

标签: jquery datatable


【解决方案1】:

操作。我必须按照文档中的说明添加页脚

<table id="orderList">
                <thead>
                    <tr>
                        <th><input type=checkbox name='allSelect' class="allSelect"></th>
                        <th> h1 </th>
                        <th> h2 </th>
                        <th> h3 </th>
                        <th> h4 </th>
                        <th> h5 </th>
                    </tr>
                </thead>
<tfoot>
        <tr>
            <th>Rendering engine</th>
            <th>Rendering engine</th>
            <th>Browser</th>
            <th>Platform(s)</th>
            <th>Engine version</th>
            <th>CSS grade</th>
        </tr>
    </tfoot>
            </table>

【讨论】:

  • 是的。正如我在回答中提到的,当我添加页脚部分时,它开始起作用。如果不想添加页脚,sPlaceHolder: "head:after",必须添加到columnFilter
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-18
  • 2020-10-20
  • 2012-12-21
  • 1970-01-01
  • 2013-07-30
相关资源
最近更新 更多