diff --git a/IPython/html/static/notebook/js/widgetmanager.js b/IPython/html/static/notebook/js/widgetmanager.js index f238620..beb2697 100644 --- a/IPython/html/static/notebook/js/widgetmanager.js +++ b/IPython/html/static/notebook/js/widgetmanager.js @@ -72,15 +72,17 @@ }; - WidgetManager.prototype.display_view = function(msg_id, model) { - var cell = this.get_msg_cell(msg_id); + WidgetManager.prototype.display_view = function(msg, model) { + var cell = this.get_msg_cell(msg.parent_header.msg_id); if (cell === null) { console.log("Could not determine where the display" + " message was from. Widget will not be displayed"); } else { var view = this.create_view(model, {cell: cell}); - if (view !== undefined - && cell.widget_subarea !== undefined + if (view === undefined) { + console.error("View creation failed", model); + } + if (cell.widget_subarea !== undefined && cell.widget_subarea !== null) { cell.widget_area.show(); diff --git a/IPython/html/static/notebook/js/widgets/widget.js b/IPython/html/static/notebook/js/widgets/widget.js index 3419778..3501700 100644 --- a/IPython/html/static/notebook/js/widgets/widget.js +++ b/IPython/html/static/notebook/js/widgets/widget.js @@ -79,7 +79,7 @@ function(widget_manager, underscore, backbone){ this.trigger('msg:custom', msg.content.data.custom_content); break; case 'display': - this.widget_manager.display_view(msg.parent_header.msg_id, this); + this.widget_manager.display_view(msg, this); break; } },