From d1e937626f9815f92201cd3aa48da561f87f3178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 1 Jul 2013 18:31:04 +0200 Subject: [PATCH] Call display of root screen after group changed is done --- src/model.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/model.js b/src/model.js index d75ca42451..cf3033e760 100644 --- a/src/model.js +++ b/src/model.js @@ -199,12 +199,16 @@ }; array.changed = function() { if (!this.parent) { - return; + return jQuery.when(); } this.parent._changed[this.child_name] = true; - this.parent.model.fields[this.child_name].changed(this.parent); - // TODO validate parent - this.parent.group.changed(); + var prm = jQuery.Deferred(); + this.parent.model.fields[this.child_name].changed(this.parent).then( + function() { + // TODO validate parent + this.parent.group.changed().done(prm.resolve); + }.bind(this)); + return prm; }; array.root_group = function() { var root = this; @@ -756,9 +760,11 @@ record._changed[this.name] = true; this.changed(record).done(function() { // TODO validate + parent - record.group.changed(); - record.group.root_group().screens.forEach(function(screen) { - screen.display(); + record.group.changed().done(function() { + record.group.root_group().screens.forEach( + function(screen) { + screen.display(); + }); }); }); } else if (force_change) {