fix clearing the sidebar so filters can be re-added after a reconnect

This commit is contained in:
Damien Churchill 2009-03-21 11:49:43 +00:00
parent 3f8ef6c66e
commit 6b7302ed4b
1 changed files with 7 additions and 5 deletions

View File

@ -338,10 +338,11 @@ Deluge.SideBar = {
}, },
onDisconnect: function() { onDisconnect: function() {
this.Bar.items.each(function(panel) { this.panels.getKeys().each(function(el) {
panel.destroy(); this.Bar.remove(el + '-panel');
}); }, this);
this.panels.empty(); this.panels.empty();
this.selected = null;
}, },
renderer: function(value, p, r) { renderer: function(value, p, r) {
@ -411,6 +412,7 @@ Deluge.SideBar = {
}); });
var panel = new Ext.grid.GridPanel({ var panel = new Ext.grid.GridPanel({
id: filter + '-panel',
store: store, store: store,
title: title, title: title,
cls: 'x-deluge-filters', cls: 'x-deluge-filters',
@ -432,7 +434,9 @@ Deluge.SideBar = {
}); });
store.loadData(states); store.loadData(states);
this.Bar.add(panel); this.Bar.add(panel);
this.Bar.doLayout(); this.Bar.doLayout();
this.panels[filter] = panel;
if (!this.selected) { if (!this.selected) {
panel.getSelectionModel().selectFirstRow(); panel.getSelectionModel().selectFirstRow();
@ -442,8 +446,6 @@ Deluge.SideBar = {
panel: panel panel: panel
} }
} }
this.panels[filter] = panel;
}, },
onSelect: function(selModel, rowIndex, record) { onSelect: function(selModel, rowIndex, record) {