Filter options filtered by another filter (@ManyToMany)

I have a entity ‘NewEntity’ and need filter by 2 attributes: TupyGroup, and after filter by TupyUser (should show only users from group).

How do it? I found 2 alternatives, and both need improvements on the Cuba source code:

Alternative A:
1- Create a custom filter with ParamWhere= “:component$filter.groups12345 MEMBER OF {E}.groups”;
2- (Improvement) - Alter parser in FilterDataContext.166, to get object referente and not the id from the component filter;

Alternative B:
1- (Improvement)- Provide a field ‘Param Join’(similar Param Where) to build more complexeds querys. Then is possible to create a query like this:
Param Join: join e.groups g
Param Where: :component$filter.groups12345 =
The Cuba parser, when filtering users from group selected, will build a query like this: “select e from app_User e join e.groups g where :component_filter_groups12345 =”;

Any another ideia to solve what I need? (88.2 KB)

If you hit the limits of generic filter, I would recommend creating a custom filter using regular input fields and DataLoadCoordinator.

1 Like

Tank you Konstantin.

Is possible to you open a issue as a improvement, to we can use filter with ‘MEMBER OF’?

Please create an issue here: Issues · cuba-platform/cuba · GitHub

1 Like