jQuery-QueryBuilder
jQuery-QueryBuilder copied to clipboard
getRules on boolean type returns differently when there are more than one operator
Hi, I am using filter with boolean type. I realise that 'getRules' doesn't work as expected when there are more than one operator.
The reason why i need two operators (ie. "equal" and "not_equal") because I have integrated your filter with the ability to input a dynamic value from somewhere else. Thus it would be helpful if I can do eg.
param_1 = "true"
test: field_1 equal param_1
test: field_1 not_equal param_1
Fiddle below: Works - One operator, getRules return 1 or 0 https://jsfiddle.net/fh7q3Lz4/7/
Fail - Two operators, getRules return true or false https://jsfiddle.net/fh7q3Lz4/8/
I have tested with an older version that works (ie. 2.4.3) https://jsfiddle.net/fh7q3Lz4/9/
There is not difference between your two examples , both have the same behavior :
- if you hit "getRules" without touching the rule you get
"0"
- if you change the rule value your
true
orfalse
(which is the correct behavior as typedboolean
)
Sorry, please try clicking on the true/ false radio and getRules again. Because then it will trigger the correct onchange
To replicate: Click true radio button Click "Get Rules" Click "Set Rules"
The radio button will not be selected now
Yas that's exactly what I said.
Now why are you using type: 'boolean'
if you want "0"
and "1"
as string ?
You're right. First 2 has the same behavior, my bad. Only the older version has the behavior I was expecting.
Are you suggesting that I should get 0 or 1 as integer
in order to work?