Multi column filtering

Multi column filtering

jinsyojinsyo Posts: 3Questions: 0Answers: 0
edited March 2011 in General
Hi,
Is it possible to have multi-column filtering with text input for certain columns and select input for certain columns?
Thanks for any help!

Replies

  • GerardoGerardo Posts: 66Questions: 0Answers: 0
    Yes. You have to write your custom filtering function, see http://datatables.net/examples/plug-ins/range_filtering.html, and http://datatables.net/examples/api/multi_filter_select.html .

    Hth,
    Gerardo
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    I don't think you need a custom filtering plug-in, you just need to use a combination of these two example:

    http://datatables.net/examples/api/multi_filter.html
    http://datatables.net/examples/api/multi_filter_select.html

    Basically the idea is that whenever you want to do a filter, DataTables doesn't care about the source, just call fnFilter() with whatever you want the filter to act on for your given column.

    Allan
  • jinsyojinsyo Posts: 3Questions: 0Answers: 0
    Thank you!
    I figured DataTables does not care about the source, but I am not sure how to call it for one particular column. The examples for select multi column filtering was for all columns..Basically this is what I have for using text input.
















    I want to change the ticketType filter to a select filter. Do I just add that in html instead of in javascript?

    An awesome product btw!
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    > An awesome product btw!

    Thanks!

    > I want to change the ticketType filter to a select filter. Do I just add that in html instead of in javascript?

    Yes - you can do it in either HTML or Javascript - it doesn't really matter which to DataTables. As long as you attach the required event handler (i.e. $().change() for select elements and $().keyup() for inputs) then you just need to call fnFilter with the selected / input value (and the column index).

    Allan
  • jinsyojinsyo Posts: 3Questions: 0Answers: 0
    Allan,
    Thank you for the guidance!
    That worked.
    J O.
This discussion has been closed.