External Form filtering on Datatables

External Form filtering on Datatables

COLTstreetCOLTstreet Posts: 3Questions: 2Answers: 0

Hello, I was wondering if it's possible to have an external form with a text list of categories, and upon clicking on the text of one of the categories it would filter the table based on the text selection. So it would sort of act like the column filtering with a combobox, except the options would be listed out in kind of a sidebar style form. Any help would be appreciated and code examples would be even more appreciated. Thank you.

Answers

  • jrizzi1jrizzi1 Posts: 44Questions: 12Answers: 3
    edited May 2015

    you can bind html form elements that call your table object

    table = $('#example').DataTable();
    $('#custom-filter').on("change", function(){
        table.draw();
      });
    

    https://www.datatables.net/plug-ins/filtering/

    just put those in your sidebar, it will be up to you to design style your sidebar form

  • COLTstreetCOLTstreet Posts: 3Questions: 2Answers: 0

    So what is the actual code inside the function to filter the table? Sorry if this is a dumb question. I'm really new to DataTables.

This discussion has been closed.