two inputs controlling filtering of one column

two inputs controlling filtering of one column

abbottmwabbottmw Posts: 29Questions: 0Answers: 0
edited June 2010 in General
I am doing some custom filtering. I have a checkbox, and a select dropdown.
The checkbox filter i was running filters using a regex saying "give me everything BUT foo"

The select dropdown has "foo" as a selection, and it is set to filter the same column.

The problem im having is both are working independantly, and not together.
If i have the checkbox to hide foo, then select foo in the dropdown, the foo records show.

I need to figure out how to make them work together so it will take into consideration what each form field is doing.

Ive looked at doing a custom filter, but I dont see a lot of examples on how to do it, or how to do it in my use case.

Any help is greatly appreciated

-Matthew

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Matthew,

    I think the answer to your question probably lies in what you want to happen when 'not foo' is selected at the same time as 'foo'.

    I'd suggest there are two options:

    1. Combine the two values together whenever either one changes, and apply the result to fnFilter. This way you can control it perfectly, and possibly add notification that the input is invalid.

    2. Do custom filtering as you suggest (also as you suggest, there is only really one example of that at the moment, plus the development documentation). But how that would work depends on the behaviour you want.

    Allan
  • abbottmwabbottmw Posts: 29Questions: 0Answers: 0
    I was trying to write a regex that basically says select foo1 but not foo2.
    I'm was having a problem writing that.

    How do you suggest combining values?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'm afraid I'm not a regex expert, so I'll be of limited help here. ^(foo2) is not foo2, as I'm sure you know. But I'm still not clear on how you intend to search for 'foo AND NOT foo' (from the original description).

    Allan
  • abbottmwabbottmw Posts: 29Questions: 0Answers: 0
    it will be more like x AND NOT y. There will be a time when both the checkbox is checked (not foo), and foo will be selected in the dropdown, so yes I will have to figure out how to handle that. Im still not sure the best way to do it.

    -matthew
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Ah I see x AND NOT y... I'm not sure how you would do that when the order could be xy or yx to be honest... I think your best bet is a regex forum. Sorry :-(

    Allan
  • abbottmwabbottmw Posts: 29Questions: 0Answers: 0
    Allan,

    I sent you a simple example of what i was trying to do to your email. I made a demo table and form fields etc.
    Shows them working independantly, but Im still needing to figure out how to make them work together.
This discussion has been closed.