Sidebar menu with sub menus - cannot expand to access sub-menus
See original GitHub issueIssue type:
- Feature request
- Bug report
- Documentation
Environment:
- AdminLTE Version: 2.4.10 with Angular 7
- Operating System: Windows 10
- Browser (Version): Recent Chrome (Electron)
Description:
The same issue was reported many times with the sidebar menu not expanding when clicked to access the sub-menus => can not access the sub-menus. I tried without success all things suggested here - https://github.com/ColorlibHQ/AdminLTE/issues/1666 and here https://github.com/ColorlibHQ/AdminLTE/issues/1570
What was tried
- Loading Admin LTE globally in the angular.json under the scripts section like this
"scripts": [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js",
"./node_modules/admin-lte/dist/js/adminlte.min.js"
]
In the html I have <ul class="sidebar-menu" data-widget="tree">
When I try to execute
$(document).ready(() => {
const trees: any = $('[data-widget="tree"]');
if (trees) {
trees.tree();
}
});
I get the error .tree() function was not found. The user @thiagoreis got the same error here https://github.com/ColorlibHQ/AdminLTE/issues/1570. Later @thiagoreis suggested a solution which without success (I tried but I get the same error).
- I removed adminlte.min.js from angular.json scripts and tried to load using
import 'admin-lte'
(did not work) and then I tried alsorequire ('admin-lte')
- did not work either I always get the same error .tree() function was not found
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Building a menu with sub-options (collapsible sub-menus) in ...
Your browser can't play this video. Learn more.
Read more >issues collapsing nested javascript menus - Stack Overflow
I have a sidebar navigation menu (HTML5/CSS/Vanilla JavaScript) that acts like an accordion with multiple levels of nested menus.
Read more >Targeting Menu Elements with Submenus in a Navigation Bar
The common way to address this issue, is to simply add a class to the <li> s that contain <ul> s (sub menus)...
Read more >Internet Explorer: Not expanding the sub-menus
On the left side, there is a menu 'Contributions Caps". Using a click on its + sign I can expand it. However when...
Read more >Fix to the SUB-MENU problem on MOBILE DEVICES: Revisted
This problem was resolved on the forum. This write up is just to clarify the steps required to get the Menu to display...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In case anyone is struggling with this, this thread was really helpful: (https://stackoverflow.com/questions/45512475/angular4-cant-find-jquery-ui-functions) – look for the answer of Chris and after applying it, follow the code:
on the ngOnInit of your component
Great!!! It really works!!!