Adminlte: treeview no working submenu

Created on 16 Sep 2019  路  6Comments  路  Source: ColorlibHQ/AdminLTE

The treeview for the side menu does not work, where you can see the submenus, I am working with angular loading the file /dist/js/adminlte.js.

When entering from the login the treeview does not work, but when reloading the page it already works.
Can you guide me how to solve this please

js question 3.x

Most helpful comment

I use the version 3.0.0-beta.2
use $('[data-widget="treeview"]').Treeview('init')

All 6 comments

Which AdminLTE version you use?
You need to init the treeview after entering via login.

Hi, I'm using the AdminLTE-3.0.0-rc.1 version, and the angular 8 version

I have a login component and another dashboard component, when you log in, open the dashboard component,

so I am loading the scripts in the angular.json file

"src / assets / js / index.js",
"src / assets / plugins / jquery / jquery.min.js",
"src / assets / plugins / jquery-ui / jquery-ui.min.js", "src / assets / plugins / bootstrap / js / bootstrap.bundle.min.js",
"src / assets / plugins / chart.js / Chart.min.js",
"src / assets / plugins / jquery-knob / jquery.knob.min.js",
"src / assets / plugins / moment / moment.min.js", "src / assets / plugins / daterangepicker / daterangepicker.js",
"src / assets / plugins / tempusdominus-bootstrap-4 / js / tempusdominus-bootstrap-4.min.js",
"src / assets / plugins / summernote / summernote-bs4.min.js", "src / assets / plugins / overlayScrollbars / js / jquery.overlayScrollbars.min.js",
"src / assets / dist / js / adminlte.js",
"src / assets / dist / js / pages / dashboard.js",
"src / assets / dist / js / demo.js"

In the dashboard.component.ts component where I have the template should I load something like this into the ngOnInit method?

ngOnInit () {
聽聽聽
聽聽聽聽$ (document) .ready (() => {
聽聽聽聽聽聽const trees: any = $ ('[data-widget = "treeview"]');
聽聽聽聽聽聽trees.Treeview();
聽聽聽聽});
聽}

I appreciate your understanding and help I am just starting with angular and I want to be able to work with this template, thank you very much

ngOnInit looks good, do you recieve any console error?

I use the version 3.0.0-beta.2
use $('[data-widget="treeview"]').Treeview('init')

@REJack @zhenxingshan

Hello, I would like to thank you for your help, the following code worked perfectly for me
$('[data-widget="treeview"]').Treeview('init') in ngOnInit()

it's closed but, can be useful for someone.
Im loading the submenus dynamically, i fix this using:

//path of your adminlte.js
import * as adminlte from '@assets/js/adminlte.js';

ngOnInit() {
    adminlte.Treeview('init');
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

REJack picture REJack  路  3Comments

tester10 picture tester10  路  3Comments

jrlooney picture jrlooney  路  3Comments

jrandhawa09 picture jrandhawa09  路  3Comments

vbetancourt picture vbetancourt  路  3Comments