luci-base: ui.js: dispatch "cbi-tab-active" event when a tab is selected
This is useful to lazy-load tab contents.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit bf774e4c2a
)
This commit is contained in:
parent
ce4d8c5a9a
commit
c7c78291f1
1 changed files with 5 additions and 0 deletions
|
@ -3293,6 +3293,10 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
|
|||
this.setActiveTabId(panes[selected], selected);
|
||||
}
|
||||
|
||||
panes[selected].dispatchEvent(new CustomEvent('cbi-tab-active', {
|
||||
detail: { tab: panes[selected].getAttribute('data-tab') }
|
||||
}));
|
||||
|
||||
this.updateTabs(group);
|
||||
},
|
||||
|
||||
|
@ -3420,6 +3424,7 @@ return L.Class.extend(/** @lends LuCI.ui.prototype */ {
|
|||
if (L.dom.matches(pane, '[data-tab]')) {
|
||||
if (pane.getAttribute('data-tab') === name) {
|
||||
pane.setAttribute('data-tab-active', 'true');
|
||||
pane.dispatchEvent(new CustomEvent('cbi-tab-active', { detail: { tab: name } }));
|
||||
L.ui.tabs.setActiveTabId(pane, index);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue