From a8bea3d86f8dbd9a5acfea59866923c5204362ae 2014-11-24 23:24:40 From: Jason Grout Date: 2014-11-24 23:24:40 Subject: [PATCH] Merge branch 'viewlists' of https://github.com/jasongrout/ipython into viewlists --- diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 03e4c34..94597c4 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -603,7 +603,7 @@ define(["widgets/js/manager", // will be called in that context. this.initialize.apply(this, arguments); - } + }; _.extend(ViewList.prototype, { initialize: function(create_view, remove_view, context) { @@ -663,7 +663,7 @@ define(["widgets/js/manager", this.state_change = this.state_change.then(function() { for (var i = 0, len=that.views.length; i ', {id: uuid + 'Content'}) .addClass('tab-content') .appendTo(this.$el); - this.containers = []; - this.update_children([], this.model.get('children')); - this.model.on('change:children', function(model, value, options) { - this.update_children(model.previous('children'), value); - }, this); + this.children_views.update(this.model.get('children')); }, update_attr: function(name, value) { @@ -161,14 +165,6 @@ define([ this.$tabs.css(name, value); }, - update_children: function(old_list, new_list) { - // Called when the children list is modified. - this.do_diff(old_list, - new_list, - $.proxy(this.remove_child_model, this), - $.proxy(this.add_child_model, this)); - }, - remove_child_model: function(model) { // Called when a child is removed from children list. var view = this.pop_child_view(model); @@ -254,6 +250,11 @@ define([ .removeClass('active'); this.containers[index].tab('show'); }, + + remove: function() { + TabView.__super__.remove.apply(this, arguments); + this.children_views.remove(); + }, }); return {