0

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

Malin
  • 97
  • 1
  • 8
  • Not sure I understand exactly what you want, but check out this [jsfiddle](http://jsfiddle.net/fr0z3nfyr/vwyLq21m/2/). If you remove the last query the AND/OR gets disabled. What happens if you add a new query for the requested "OR" ? What happens if you add new with "NY REGEL"? – mapa0402 Jan 26 '22 at 13:29
  • @mapa0402 Sorry if it was unclear. With your example, I would first click "Add group" then - the "and/or" is disabled as you said. But if i click "Add rule" in that group then "AND" is selected by default. I want "OR" to be selected by default between rules in a group. – Malin Jan 26 '22 at 13:47

1 Answers1

0

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

mapa0402
  • 454
  • 1
  • 8
  • 24