diff --git a/IPython/html/static/notebook/js/widgetmanager.js b/IPython/html/static/notebook/js/widgetmanager.js
index 524f7b037..f2386207f 100644
--- a/IPython/html/static/notebook/js/widgetmanager.js
+++ b/IPython/html/static/notebook/js/widgetmanager.js
@@ -78,12 +78,11 @@
console.log("Could not determine where the display" +
" message was from. Widget will not be displayed");
} else {
- var view = this.create_view(model);
+ var view = this.create_view(model, {cell: cell});
if (view !== undefined
&& cell.widget_subarea !== undefined
&& cell.widget_subarea !== null) {
- view.cell = cell;
cell.widget_area.show();
cell.widget_subarea.append(view.$el);
}
@@ -141,7 +140,7 @@
WidgetManager.prototype.callbacks = function (view) {
// callback handlers specific a view
var callbacks = {};
- var cell = view.cell;
+ var cell = view.options.cell;
if (cell !== null) {
// Try to get output handlers
var handle_output = null;
diff --git a/IPython/html/static/notebook/js/widgets/widget.js b/IPython/html/static/notebook/js/widgets/widget.js
index e5d68c70a..2b13062c5 100644
--- a/IPython/html/static/notebook/js/widgets/widget.js
+++ b/IPython/html/static/notebook/js/widgets/widget.js
@@ -226,8 +226,14 @@ function(widget_manager, underscore, backbone){
create_child_view: function(child_model, options) {
// Create and return a child view.
//
- // - given a model and (optionally) a view name if the view name is
+ // -given a model and (optionally) a view name if the view name is
// not given, it defaults to the model's default view attribute.
+
+ // TODO: this is hacky, and makes the view depend on this cell attribute and widget manager behavior
+ // it would be great to have the widget manager add the cell metadata
+ // to the subview without having to add it here.
+ options = options || {};
+ options.cell = this.options.cell;
var child_view = this.model.widget_manager.create_view(child_model, options);
this.child_views[child_model.id] = child_view;
return child_view;