Querybuilder.js - How can I limit the conditions to have "AND" in the root, and "OR" in the subgroups?

500 views Asked by At

I am used to working in C#, and just got handed this project with querybuilder. I have been searching for hours and can't seem to figure out how to achieve this.

What I want is for the root condition to be "AND" - which is default.

But since it is default - when I click "Add group" and then "Add rule" in that group, the "And"-condition is selected by default. But I want the "or" to be selected between rules in all groups.

I added a photo which you can reach with below link.

Does anyone have an idea? It would be highly appreciated.

Limit conditions in querybuilder subgroups

1

There are 1 answers

0
mapa0402 On

Ok, I would then do something like this with jQuery:

$('#btn-add-rule').on('click', function() {
    $("#btn-parameter-or").trigger("click");
});

It can be a bit rough if the buttons don't have unique ids or classes, then you have to select by nth-child() selector