File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ const EVENT_KEY = `.${DATA_KEY}`
24
24
25
25
const EVENT_EXPANDED = `expanded${ EVENT_KEY } `
26
26
const EVENT_COLLAPSED = `collapsed${ EVENT_KEY } `
27
- // const EVENT_LOAD_DATA_API = `load${EVENT_KEY}`
27
+ const EVENT_LOAD_DATA_API = `load${ EVENT_KEY } `
28
28
29
29
const CLASS_NAME_MENU_OPEN = 'menu-open'
30
30
const SELECTOR_NAV_ITEM = '.nav-item'
@@ -112,6 +112,18 @@ class Treeview {
112
112
*/
113
113
114
114
onDOMContentLoaded ( ( ) => {
115
+ const openMenuItems = document . querySelectorAll ( `${ SELECTOR_NAV_ITEM } .${ CLASS_NAME_MENU_OPEN } ` )
116
+
117
+ openMenuItems . forEach ( menuItem => {
118
+ const childElement = menuItem . querySelector ( SELECTOR_TREEVIEW_MENU ) as HTMLElement | undefined
119
+ if ( childElement ) {
120
+ slideDown ( childElement , 0 )
121
+
122
+ const event = new Event ( EVENT_LOAD_DATA_API )
123
+ menuItem . dispatchEvent ( event )
124
+ }
125
+ } )
126
+
115
127
const button = document . querySelectorAll ( SELECTOR_DATA_TOGGLE )
116
128
117
129
button . forEach ( btn => {
You can’t perform that action at this time.
0 commit comments