Skip to content

Commit 507e416

Browse files
mokaddemmistic100
authored andcommitted
chg: [plugin:chosen] avoid creating useless chosen widget (mistic100#743)
Prevent the creation of an glitchy empty chosen widget in case of a select containing only one value.
1 parent 73cb350 commit 507e416

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/plugins/chosen-selectpicker/plugin.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ QueryBuilder.define('chosen-selectpicker', function(options) {
2323
});
2424

2525
this.on('afterCreateRuleOperators', function(e, rule) {
26-
rule.$el.find(Selectors.rule_operator).removeClass('form-control').chosen(options);
26+
if (e.builder.getOperators(rule.filter).length > 1) {
27+
rule.$el.find(Selectors.rule_operator).removeClass('form-control').chosen(options);
28+
}
2729
});
2830

2931
// update selectpicker on change

0 commit comments

Comments
 (0)