Skip to content

Commit 7699723

Browse files
committed
Fix #682 : allow to change group condition in afterAddGroup event
1 parent d3ac611 commit 7699723

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/core.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,10 @@ QueryBuilder.prototype.setRoot = function(addRule, data, flags) {
353353

354354
this.model.root.data = data;
355355
this.model.root.__.flags = $.extend({}, this.settings.default_group_flags, flags);
356+
this.model.root.condition = this.settings.default_condition;
356357

357358
this.trigger('afterAddGroup', this.model.root);
358359

359-
this.model.root.condition = this.settings.default_condition;
360-
361360
if (addRule) {
362361
this.addRule(this.model.root);
363362
}
@@ -399,6 +398,7 @@ QueryBuilder.prototype.addGroup = function(parent, addRule, data, flags) {
399398

400399
model.data = data;
401400
model.__.flags = $.extend({}, this.settings.default_group_flags, flags);
401+
model.condition = this.settings.default_condition;
402402

403403
/**
404404
* Just after adding a group
@@ -415,8 +415,6 @@ QueryBuilder.prototype.addGroup = function(parent, addRule, data, flags) {
415415
*/
416416
this.trigger('rulesChanged');
417417

418-
model.condition = this.settings.default_condition;
419-
420418
if (addRule) {
421419
this.addRule(model);
422420
}

0 commit comments

Comments
 (0)