mistic100 / jQuery-QueryBuilder

jQuery plugin offering an interface to create complex queries
https://querybuilder.js.org
MIT License
1.68k stars 552 forks source link

onAfterSetValue example correctness #926

Closed dpnishant closed 3 years ago

dpnishant commented 3 years ago

Is this example event handler correct: https://github.com/mistic100/jQuery-QueryBuilder/blob/dev/examples/index.html#L417-L421

With the debugger I'm not "breaking into" this function, even if I edited the HTML with a JSON that includes this rule filter with a value.

mistic100 commented 3 years ago

That's some outdated code.
The correct way is to use valueSetter filter property and/or afterUpdateRuleValue event

dpnishant commented 3 years ago

@mistic100 So if I understand correctly currently it is not supported to declaratively define event handlers on a per-filter basis. Is that correct?

mistic100 commented 3 years ago

I was possible and will never be again. It's not a problem though afterUpdateRuleValue is called with a rule object and you can test the filter applied.

dpnishant commented 3 years ago

Got it. Thanks for the confirmation.