Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invert plugin and custom operators (operatorOpposites and conditionOpposites update defaults) #972

Open
Guilouf opened this issue Jun 7, 2023 · 1 comment

Comments

@Guilouf
Copy link

Guilouf commented Jun 7, 2023

I see here in the doc https://querybuilder.js.org/plugins.html#invert that i need to update operatorOpposites and conditionOpposites in order to my customs operators

The plugin uses the operatorOpposites and conditionOpposites builder options to map each condition/operator to its invert. You must update it if you add new operators and conditions.

Right, but how do i update these ? I tried something like

  $('#builder-basic').queryBuilder.defaults({
    operatorOpposites: {
       'equal': 'not_equal',
  }}
  )

but it have no effects. Am i supposed to directly modify the plugin source code ??

@mistic100
Copy link
Owner

Like other options of the builder provided at init

$('#builder-basic').queryBuilder({
   plugins: {
       invert: null,
   },
   operatorOpposites: {
       'equal': 'not_equal',
   }
});

(no idea why this was done here and not in the plugin's options...)

BTW here is the default config (yours will be merged with it)
https://github.com/mistic100/jQuery-QueryBuilder/blob/dev/src/plugins/invert/plugin.js#L65-L91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants