Show More
@@ -56,11 +56,14 define(["../../components/underscore/underscore-min.js", | |||||
56 | this.save(this.changedAttributes(), {patch: true}); |
|
56 | this.save(this.changedAttributes(), {patch: true}); | |
57 |
|
57 | |||
58 | for (var cell_index in this.views) { |
|
58 | for (var cell_index in this.views) { | |
59 | var view = this.views[cell_index]; |
|
59 | var views = this.views[cell_index]; | |
|
60 | for (var view_index in views) { | |||
|
61 | var view = views[view_index]; | |||
60 | if (view !== caller) { |
|
62 | if (view !== caller) { | |
61 | view.update(); |
|
63 | view.update(); | |
62 | } |
|
64 | } | |
63 | } |
|
65 | } | |
|
66 | } | |||
64 | }, |
|
67 | }, | |
65 |
|
68 | |||
66 |
|
69 | |||
@@ -177,9 +180,12 define(["../../components/underscore/underscore-min.js", | |||||
177 | // Handle when a widget is closed. |
|
180 | // Handle when a widget is closed. | |
178 | handle_comm_closed: function (msg) { |
|
181 | handle_comm_closed: function (msg) { | |
179 | for (var cell_index in this.views) { |
|
182 | for (var cell_index in this.views) { | |
180 | var view = this.views[cell_index]; |
|
183 | var views = this.views[cell_index]; | |
|
184 | for (var view_index in views) { | |||
|
185 | var view = views[view_index]; | |||
181 | view.remove(); |
|
186 | view.remove(); | |
182 | } |
|
187 | } | |
|
188 | } | |||
183 | }, |
|
189 | }, | |
184 |
|
190 | |||
185 |
|
191 | |||
@@ -187,17 +193,23 define(["../../components/underscore/underscore-min.js", | |||||
187 | display_view: function (view_name, parent_comm_id, cell_index) { |
|
193 | display_view: function (view_name, parent_comm_id, cell_index) { | |
188 | var view = new this.widget_view_types[view_name]({model: this}); |
|
194 | var view = new this.widget_view_types[view_name]({model: this}); | |
189 | view.render(); |
|
195 | view.render(); | |
190 |
this.views[cell_index] |
|
196 | if (this.views[cell_index]==undefined) { | |
|
197 | this.views[cell_index] = [] | |||
|
198 | } | |||
|
199 | this.views[cell_index].push(view); | |||
191 | view.cell_index = cell_index; |
|
200 | view.cell_index = cell_index; | |
192 |
|
201 | |||
193 | // Handle when the view element is remove from the page. |
|
202 | // Handle when the view element is remove from the page. | |
194 | var that = this; |
|
203 | var that = this; | |
195 | view.$el.on("remove", function(){ |
|
204 | view.$el.on("remove", function(){ | |
196 | var index = that.views.indexOf(view); |
|
205 | var index = that.views[cell_index].indexOf(view); | |
197 | if (index > -1) { |
|
206 | if (index > -1) { | |
198 | that.views.splice(index, 1); |
|
207 | that.views[cell_index].splice(index, 1); | |
199 | } |
|
208 | } | |
200 | view.remove(); // Clean-up view |
|
209 | view.remove(); // Clean-up view | |
|
210 | if (that.views[cell_index].length()==0) { | |||
|
211 | delete that.views[cell_index]; | |||
|
212 | } | |||
201 |
|
213 | |||
202 | // Close the comm if there are no views left. |
|
214 | // Close the comm if there are no views left. | |
203 | if (that.views.length()==0) { |
|
215 | if (that.views.length()==0) { |
General Comments 0
You need to be logged in to leave comments.
Login now