##// END OF EJS Templates
Store views in the models and store child views in the views
Jason Grout -
Show More
@@ -98,8 +98,7 b''
98 98 if (ViewType !== undefined && ViewType !== null) {
99 99 var view = new ViewType({model: model, widget_manager: this, cell: cell});
100 100 view.render();
101 //this.views.push(view);
102
101 model.views.push(view);
103 102 /*
104 103 // jng: Handle when the view element is remove from the page.
105 104 // observe the view destruction event and do this. We may need
@@ -29,6 +29,7 b' function(widget_manager, underscore, backbone){'
29 29 this.msg_throttle = 3;
30 30 this.msg_buffer = null;
31 31 this.id = widget_id;
32 this.views = [];
32 33
33 34 if (comm !== undefined) {
34 35 // Remember comm associated with the model.
@@ -43,7 +44,6 b' function(widget_manager, underscore, backbone){'
43 44
44 45 return Backbone.Model.apply(this);
45 46 },
46
47 47
48 48 send: function (content, callbacks) {
49 49 if (this.comm !== undefined) {
@@ -55,6 +55,7 b' function(widget_manager, underscore, backbone){'
55 55 // Handle when a widget is closed.
56 56 _handle_comm_closed: function (msg) {
57 57 // jng: widget manager should observe the comm_close event and delete views when triggered
58
58 59 this.trigger('comm:close');
59 60 delete this.comm.model; // Delete ref so GC will collect widget model.
60 61 delete this.comm;
@@ -178,6 +179,7 b' function(widget_manager, underscore, backbone){'
178 179 this.widget_manager = options.widget_manager;
179 180 this.comm_manager = options.widget_manager.comm_manager;
180 181 this.cell = options.cell;
182 this.child_views = [];
181 183 },
182 184
183 185 update: function(){
@@ -187,6 +189,7 b' function(widget_manager, underscore, backbone){'
187 189 child_view: function(comm_id, view_name) {
188 190 var child_model = this.comm_manager.comms[comm_id].model;
189 191 var child_view = this.widget_manager.create_view(child_model, view_name, this.cell);
192 this.child_views.push(child_view);
190 193 return child_view;
191 194 },
192 195
General Comments 0
You need to be logged in to leave comments. Login now