This solution is kludgy, but it does fix what broke when we tried to take the cell references out of views. Conflicts: IPython/html/static/notebook/js/widgets/widget.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;
@ -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;