projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e7d22dc
)
luci-base: ui.js: dispatch "cbi-tab-active" event when a tab is selected
author
Jo-Philipp Wich
<jo@mein.io>
Wed, 12 Feb 2020 07:14:22 +0000
(08:14 +0100)
committer
Jo-Philipp Wich
<jo@mein.io>
Wed, 12 Feb 2020 10:59:41 +0000
(11:59 +0100)
This is useful to lazy-load tab contents.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/ui.js
patch
|
blob
|
history
diff --git
a/modules/luci-base/htdocs/luci-static/resources/ui.js
b/modules/luci-base/htdocs/luci-static/resources/ui.js
index 7cf4f4102ffeda89d2145929bbee1007e5ccd055..44585736013caf167dcc8bcbbdaf45b33aac42bf 100644
(file)
--- a/
modules/luci-base/htdocs/luci-static/resources/ui.js
+++ b/
modules/luci-base/htdocs/luci-static/resources/ui.js
@@
-2244,6
+2244,10
@@
return L.Class.extend({
this.setActiveTabId(panes[selected], selected);
}
+ panes[selected].dispatchEvent(new CustomEvent('cbi-tab-active', {
+ detail: { tab: panes[selected].getAttribute('data-tab') }
+ }));
+
this.updateTabs(group);
},
@@
-2354,6
+2358,7
@@
return L.Class.extend({
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 {