You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
I have AdminLTE running in ReactJS but I was wondering there is a method out there for setting the parent li to .active based on the child also being .active? Achieving .active on the is easy with Navlink but setting the parent class is trickier. We would also need to have li.treeview set to li.treeview.menu-open if it has active children too. I have put together the following in jQuery and put it in componentDidMount() and componentDidUpdate() but for some reason the code is not run in those lifecycle events (I suspect it has something to do with not using refs: -
As with the code above, this too works but is not being called properly in the lifecycle events. Although is should be pointed out that the second piece of code is doing .trigger("click") on all li.treeview nodes, regardless of whether or they have children with a.active (i.e. in multiple nested menus).
Any help/thoughts/advice?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have AdminLTE running in ReactJS but I was wondering there is a method out there for setting the parent li to .active based on the child also being .active? Achieving .active on the is easy with Navlink but setting the parent class is trickier. We would also need to have li.treeview set to li.treeview.menu-open if it has active children too. I have put together the following in jQuery and put it in componentDidMount() and componentDidUpdate() but for some reason the code is not run in those lifecycle events (I suspect it has something to do with not using refs: -
$('ul.sidebar-menu li:not(.treeview):has(a.active)').addClass('active');
The following sets the li.treeview classes by event triggering: -
$('ul.sidebar-menu li.treeview:not(.menu-open)').has('a.active').find('a').trigger( "click" );
As with the code above, this too works but is not being called properly in the lifecycle events. Although is should be pointed out that the second piece of code is doing .trigger("click") on all li.treeview nodes, regardless of whether or they have children with a.active (i.e. in multiple nested menus).
Any help/thoughts/advice?
The text was updated successfully, but these errors were encountered: