Skip to content

Commit a15746a

Browse files
committed
Fix #104 cannot initialize operators with zero input
1 parent 6d43793 commit a15746a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/core.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ QueryBuilder.prototype.updateRuleOperator = function(rule, previousOperator) {
489489
if ($valueContainer.is(':empty') || rule.operator.nb_inputs !== previousOperator.nb_inputs) {
490490
this.createRuleInput(rule);
491491
}
492+
}
492493

494+
if (rule.operator) {
493495
rule.$el.find('.rule-operator-container [name$=_operator]').val(rule.operator.type);
494496
}
495497

src/public.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,6 @@ QueryBuilder.prototype.setRules = function(data) {
212212
if (rule.id === undefined) {
213213
error('Missing rule field id');
214214
}
215-
if (rule.value === undefined) {
216-
rule.value = '';
217-
}
218215
if (rule.operator === undefined) {
219216
rule.operator = 'equal';
220217
}
@@ -232,7 +229,7 @@ QueryBuilder.prototype.setRules = function(data) {
232229
model.data = rule.data;
233230
}
234231

235-
if (model.operator.nb_inputs !== 0) {
232+
if (model.operator.nb_inputs !== 0 && rule.value !== undefined) {
236233
that.setRuleValue(model, rule.value);
237234
}
238235
}

0 commit comments

Comments
 (0)