Checkmarks in browse screen for filtering based on enum

Hey guys,

I have an Order entity with an enum status. Is it possible to create checkboxes for each status with multiselect, so the user can each check/off the statusses, and toggle it in the browse overview.

I know it is possible trough filters, but I’m trying so simplify it. I tried a bit with using queryfilters, but the difficulty lies in the multiselect part.

[Edit] I’ve added a screenshot of what I try to achieve, with the checkboxes between the search section and the buttonpanel

Filtertest

Anyone got a suggestion for handling the multiselect part in the queryfilters ?

hi, @j.smeets

I’ve prepared small example for you - check in attachments.

изображение

Here is a main part of this example:

LogicalCondition condition = new LogicalCondition("statusCondition", LogicalOp.OR);

for (OrderStatus status : enabledStatuses) {
    // enum is stored by its id in the owned entity 
    condition.getConditions().add(new Clause("", "e.status = " + status.getId(), null, null, null));
}

QueryFilter queryFilter = new QueryFilter(condition);

ordersDs.setQueryFilter(queryFilter);
ordersDs.refresh();

Regards,
Daniil.

checkboxes-filter.zip (76.3 KB)

2 Likes

Hey @tsarev,

Thanks for your help. It didn’t occur to me that you could stack multiple clauses. It seems obvious tho :wink:
I’ve played around with this, and have an extended question to this. In your example, there is also a company name.

Lets say I have an company entity, with a 1:n relationship to the order. And next to the checkmarks i also have a pickerfield with the companies you can use to filter out the result.

All the checkmarks clauses are added to LogicalCondition with an ‘OR’ operator. But If I would need to add a company aswell to the queryfilter, this would need to be an ‘AND’ operator.

As far as I can see, I cant add these two together. How would I need to solve that one ?

[Edit] I’ve found out that you can add several LogicalConditions to a new Logicalcondition.