diff --git a/IPython/html/static/widgets/js/manager.js b/IPython/html/static/widgets/js/manager.js index 501b84095..caa8fd9bb 100644 --- a/IPython/html/static/widgets/js/manager.js +++ b/IPython/html/static/widgets/js/manager.js @@ -85,27 +85,27 @@ define([ } }; - WidgetManager.prototype.create_view = function(model, options) { // Creates a promise for a view of a given model return utils.load(model.get('_view_name'), model.get('_view_module'), - WidgetManager._view_types).then(function(ViewType) { - // If a view is passed into the method, use that view's cell as - // the cell for the view that is created. - options = options || {}; - if (options.parent !== undefined) { - options.cell = options.parent.options.cell; - } - // Create and render the view... - var parameters = {model: model, options: options}; - var view = new ViewType(parameters); - view.listenTo(model, 'destroy', view.remove); - view.render(); - return view; - }, function(error) { - console.error(error); - return Promise.reject(error); - }); + WidgetManager._view_types).then(function(ViewType) { + + // If a view is passed into the method, use that view's cell as + // the cell for the view that is created. + options = options || {}; + if (options.parent !== undefined) { + options.cell = options.parent.options.cell; + } + // Create and render the view... + var parameters = {model: model, options: options}; + var view = new ViewType(parameters); + view.listenTo(model, 'destroy', view.remove); + view.render(); + return view; + }, function(error) { + console.error(error); + return Promise.reject(error); + }); }; WidgetManager.prototype.get_msg_cell = function (msg_id) { diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 568eaaf52..0c3cbbf2e 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -80,7 +80,9 @@ define(["widgets/js/manager", this.trigger('msg:custom', msg.content.data.content); break; case 'display': - this.widget_manager.display_view(msg, this); + this.state_change = this.state_change.then(function () { + that.widget_manager.display_view(msg, that); + }); break; } },