jQuery-QueryBuilder icon indicating copy to clipboard operation
jQuery-QueryBuilder copied to clipboard

Disable 2 filters at the same time

Open sergiorg88 opened this issue 4 years ago • 1 comments

Hello,

I've been looking for information, but I can't find anything about it.

When I choose a filter, it is deactivated and can no longer be used in new rules. If I change to another filter in the same rule, the previous one will be available again in the rest of the rules I have already created. This is normal operation.

What I would like to do is that, when I choose a specific filter in a rule, I deactivate that filter and another that depends on that and the same action in reverse. If you change the filter, activate again the 2 filters that were deactivated.

For example, I have a series of filters but 2 of them, one to search by Name and another to search by Surname cannot coexist together, so if in a rule I choose to search by Name, besides deactivating the filter Name, I should also deactivate the filter Surname and if in the rule with filter by Name I change to another filter, then both filters should be activated again.

Could someone help me since I've been trying to do it for 2 days and I don't know how to do it?

Thank you.

sergiorg88 avatar Sep 11 '19 10:09 sergiorg88

Hi,

This feature does not exist.

You will have to do it manually by looking at how the "unique-filters" plugin works https://github.com/mistic100/jQuery-QueryBuilder/blob/dev/src/plugins/unique-filter/plugin.js

Basically it listens to the a bunch of events (lines 9 to 13), computes which filters must be disabled, and updates every filters selects to mark the corresponding options as disabled (line 98).

mistic100 avatar Sep 11 '19 10:09 mistic100