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

Operator selector rendering issue when there is only one operator #948

Open
nemphys opened this issue May 12, 2022 · 1 comment
Open

Operator selector rendering issue when there is only one operator #948

nemphys opened this issue May 12, 2022 · 1 comment

Comments

@nemphys
Copy link

nemphys commented May 12, 2022

When a rule has just one operator, both a label and a select is rendered as operator selectors.
This is due to the template:

QueryBuilder.templates.operatorSelect = '
{{? it.operators.length === 1 }}

{{= it.translate("operators", it.operators[0].type) }}

{{?}}
<------- having "else" here would fix the problem
{{ var optgroup = null; }}
{{~ it.operators: operator }} {{? optgroup !== operator.optgroup }} {{? optgroup !== null }}{{?}} {{? (optgroup = operator.optgroup) !== null }} {{?}} {{?}} <option value="{{= operator.type }}" {{? operator.icon}}data-icon="{{= operator.icon}}"{{?}}>{{= it.translate("operators", operator.type) }} {{~}} {{? optgroup !== null }}{{?}} ';

@akshit-arora
Copy link

This is not an issue.
The select dropdown should be hidden when only one operator is added.

The select element has a code class="form-control {{? it.operators.length === 1 }}hide{{?}}" that should add hide class in the select element.

Add the following CSS as mentioned in the 'No Bootstrap' page to get it working:

.query-builder .hide {
  display: none;
}

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