【问题标题】:DataTable Filtering Issue数据表过滤问题
【发布时间】:2015-08-28 23:12:48
【问题描述】:

我正在使用 jQuery 的数据表插件。我正在关注许多人使用的link's 方法;但是,我没有获得用于搜索每一列的文本框,而是在右上角获得了一个普通的文本附加列和原始搜索文本框以及显示条目保管箱正在消失。知道为什么会这样吗?

感谢任何帮助。

更新(代码)

<table id="g_table" class="table table-responsive table-bordered table-striped table-hover">
    <thead>
        <tr>
            <th>@Html.DisplayNameFor(model => model.date_time) (mm/dd/yyyy hh:mm:ss)</th>
            <th>@Html.DisplayNameFor(model => model.value_level)</th>
            <th>@Html.DisplayNameFor(model => model.alert_status)</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {           
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.date_time)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.value_level)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.alert_status)
                </td>
            </tr>
        }
    </tbody>
    <tfoot>
        <tr>
            <th>Date and Time</th>
            <th>Level</th>
            <th>Alert Status</th>
        </tr>
    </tfoot>
</table>

<script src="~/Scripts/DataTables/jquery.dataTables.min.js"></script>
<script src="~/Scripts/Highcharts-4.0.1/js/highcharts.js" type="text/javascript"></script>

<script type="text/javascript">
        $(document).ready(function () {
            $("#g_table").dataTable().columnFilter();
        });
</script>

【问题讨论】:

  • 需要查看您的代码以及您使用的 jQuery / DataTables 版本
  • @psalmody 我已经更新了我的问题并添加了代码

标签: jquery datatable filtering


【解决方案1】:

如果您检查浏览器开发人员工具,您可能会发现该插件未定义。

您需要包含该站点http://jquery-datatables-column-filter.googlecode.com/svn/trunk/media/js/jquery.dataTables.columnFilter.js提供的插件。

或者,使用更多更新的数据表和此处提供的方法https://datatables.net/examples/api/multi_filter.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-30
    • 2012-08-24
    • 1970-01-01
    • 1970-01-01
    • 2011-09-30
    • 2021-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多