[WebUI] Sidebar: fix error for lazy init

When sidebar is hidden at WebUI startup, header isn't created yet.

Signed-off-by: Xuefer H <xuefer@gmail.com>
Closes: https://github.com/deluge-torrent/deluge/pull/419
This commit is contained in:
Xuefer H 2023-04-11 18:26:53 +08:00 committed by Calum Lind
commit a83ac65ab6
No known key found for this signature in database
GPG key ID: 90597A687B836BA3

View file

@ -60,6 +60,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
this.doLayout(); this.doLayout();
this.panels[filter] = panel; this.panels[filter] = panel;
if (panel.header) {
panel.header.on('click', function (header) { panel.header.on('click', function (header) {
if (!deluge.config.sidebar_multiple_filters) { if (!deluge.config.sidebar_multiple_filters) {
deluge.ui.update(); deluge.ui.update();
@ -68,6 +69,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
panel.list.select(0); panel.list.select(0);
} }
}); });
}
this.fireEvent('filtercreate', this, panel); this.fireEvent('filtercreate', this, panel);
panel.updateStates(states); panel.updateStates(states);