数据集多选列过滤器 [英] Datatables Multi Select Column filter

查看:156
本文介绍了数据集多选列过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在列过滤器中选择多个项目。以下示例允许您使用下拉列表对列进行过滤:

I want to Select multiple items in a column filter. The following example allows you to filter on columns using dropdowns:

http://datatables.net/release-datatables/examples/api/multi_filter_select.html

但是,我会喜欢能够在列过滤器中选择多个项目,可能在下拉列表中的每个项目旁边都有一个复选框。例如在这个例子中,我会将'A'和'C'分别列为'CSS等级',这样才能在表格中显示这些成绩。

However, I would like to be able to select multiple items in the column filter, possibly with a checkbox beside each item in the dropdown. e.g. in the example, I would Tick 'A' and 'C' for 'CSS grade' so that only these grades are displayed in the table.

选择列过滤器使用DataTables插件或其他?

How can I get multi select column filters either using the DataTables plugin or otherwise?

推荐答案

您可以使用选择列表,复选框和其他任何方式构建自己的过滤器div使用 fnFilter 从服务器请求过滤的数据。例如:

You could build your own filter div with selectlists,checkboxes and whatever and use fnFilter to request filtered data from the server. For example:

$("#mycheckbox").click(function () {
     var dt = $('#mytable').dataTable({ "bRetrieve": true });
     dt.fnFilter($("#mycheckbox").is(':checked'), 1);
});

帖子:

sSearch_1 : true/false

这篇关于数据集多选列过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆