How to use Select box outside to filter dataTables?

后端 未结 1 1632
自闭症患者
自闭症患者 2020-12-31 20:40

I\'m using the DataTables Table plug-in for jQuery but I\'m having trouble getting the global input search box would be an select box.

With the sDOM option lr

相关标签:
1条回答
  • 2020-12-31 21:32

    You can use search() API method to perform global search programmatically and dom option to disable built-in search control.

    For example:

    var table = $('#example').DataTable({
       dom: 'lrtip'
    });
    
    $('#table-filter').on('change', function(){
       table.search(this.value).draw();   
    });
    

    See this example for code and demonstration. See this example, if you want to replace default search box.

    0 讨论(0)
提交回复
热议问题