Where necessary, override remove() to also remove subviews.

This commit is contained in:
Dan Wilson 2013-05-14 12:45:48 +01:00
parent 5ef821c92a
commit 93637a7b0b
2 changed files with 21 additions and 4 deletions

View File

@ -74,6 +74,11 @@ my.Flot = Backbone.View.extend({
return this;
},
remove: function () {
this.editor.remove();
Backbone.View.prototype.remove.apply(this, arguments);
},
redraw: function() {
// There are issues generating a Flot graph if either:
// * The relevant div that graph attaches to his hidden at the moment of creating the plot -- Flot will complain with

View File

@ -263,18 +263,30 @@ my.MultiView = Backbone.View.extend({
$dataSidebar.append(view.view.el);
}, this);
var pager = new recline.View.Pager({
this.pager = new recline.View.Pager({
model: this.model.queryState
});
this.$el.find('.recline-results-info').after(pager.el);
this.$el.find('.recline-results-info').after(this.pager.el);
var queryEditor = new recline.View.QueryEditor({
this.queryEditor = new recline.View.QueryEditor({
model: this.model.queryState
});
this.$el.find('.query-editor-here').append(queryEditor.el);
this.$el.find('.query-editor-here').append(this.queryEditor.el);
},
remove: function () {
_.each(this.pageViews, function (view) {
view.view.remove();
});
_.each(this.sidebarViews, function (view) {
view.view.remove();
});
this.pager.remove();
this.queryEditor.remove();
Backbone.View.prototype.remove.apply(this, arguments);
},
// hide the sidebar if empty
_showHideSidebar: function() {
var $dataSidebar = this.$el.find('.data-view-sidebar');