##// END OF EJS Templates
Merge pull request #6548 from SylvainCorlay/widget_views_by_id...
Jonathan Frederic -
r18036:e9b674db merge
parent child Browse files
Show More
@@ -26,7 +26,7 b' define(["widgets/js/manager",'
26 26 this.msg_buffer = null;
27 27 this.state_lock = null;
28 28 this.id = model_id;
29 this.views = [];
29 this.views = {};
30 30
31 31 if (comm !== undefined) {
32 32 // Remember comm associated with the model.
@@ -57,9 +57,11 b' define(["widgets/js/manager",'
57 57 delete this.comm.model; // Delete ref so GC will collect widget model.
58 58 delete this.comm;
59 59 delete this.model_id; // Delete id from model so widget manager cleans up.
60 _.each(this.views, function(view, i) {
61 view.remove();
62 });
60 for (var id in this.views) {
61 if (this.views.hasOwnProperty(id)) {
62 this.views[id].remove();
63 }
64 }
63 65 },
64 66
65 67 _handle_comm_msg: function (msg) {
@@ -293,8 +295,8 b' define(["widgets/js/manager",'
293 295 this.options = parameters.options;
294 296 this.child_model_views = {};
295 297 this.child_views = {};
296 this.model.views.push(this);
297 298 this.id = this.id || IPython.utils.uuid();
299 this.model.views[this.id] = this;
298 300 this.on('displayed', function() {
299 301 this.is_displayed = true;
300 302 }, this);
@@ -339,7 +341,7 b' define(["widgets/js/manager",'
339 341 var view = this.child_views[view_id];
340 342 delete this.child_views[view_id];
341 343 view_ids.splice(0,1);
342 child_model.views.pop(view);
344 delete child_model.views[view_id];
343 345
344 346 // Remove the view list specific to this model if it is empty.
345 347 if (view_ids.length === 0) {
General Comments 0
You need to be logged in to leave comments. Login now