Add Combo box to filter

Add Combo box to filter

pereggperegg Posts: 1Questions: 0Answers: 0
edited January 2010 in General
Hi,

first of all, excuse me for my English (I'm Spanish)... I'm a graphic designer with a little experience on html + css but very, very little in programming. I've found this jQuery script very useful but I need a feature that I don't know how to implement... maybe it's easy to do, but looks tricky for me.

The thing is we have to filter a 1600 items table, which are categorised, subcategorised and sub-subcategorised. Of course, there are also 4 or 5 columns for each item, that we are going to filter with the "search" box. To make the navigation easier, we've thought of:

1) Make 3 tables on the page, each of them with the title of the first category. This way, we will have filtered the first category.

2) Here's the problem. We would like to put, after the title of each table, a combo box (or labels... or whatever similar to this) that filters the subcategory. It would be something like a hidden column that the user doesn't see (so we have more horizontal space for the other columns) but is used to filter items. So, if you choose in the combo box "subcategory2", it makes like a filter on the search box and only shows the items for this category... In the combo we would have:
-View all subcategories (selected at initial position)
-View subcategory 1
-View subcategory ...

3) Finally, the sub-subcategory would be in a normal column, so no problem with this one.

If someone could help me on this, it would be great! If it's not possible, we'll put two columns (one for subcategories and another for sub-subcategories).

Thanks in advance!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi peregg,

    Yes indeed this can readily be done by using the fnFilter API function: http://datatables.net/api#fnFilter . Simply build up a menu with the options you want to present for the filter, and then attach an $().change() event to the menu which calls fnFilter with the value to be filtered. That should do the trick for you.

    Regards,
    Allan
This discussion has been closed.