数据表中的自定义过滤器,带有jquery中的搜索按钮

时间:2016-09-27 06:41:49

标签: jquery datatable

我正在使用datatables插件,我想添加自定义搜索按钮(Go)来过滤由datatable填充的网格。当用户点击go按钮选择药物和组织结果应该是过滤器

 $(document).ready(function() {
    $('#example').dataTable();
} );

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:1)

您似乎想要添加多个自定义下拉过滤器。

你可以这样做。

//Call datatable
var table = table =  $('#tableId').DataTable({});

//Call on change event of dropdown and same thing can be done on Go button click
$('#drugDropdownId').on('change', function () {
    //Column number can be changed as per your need
    table.columns(2).search(this.value).draw();
});

请检查DataTable Search

仅供参考,请确保您使用数据表版本的正确和受支持的方法。

相关问题