Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid Sidebar expansion when clicking a menu item #1320

Closed
malditonekro opened this issue Oct 16, 2017 · 3 comments
Closed

Avoid Sidebar expansion when clicking a menu item #1320

malditonekro opened this issue Oct 16, 2017 · 3 comments

Comments

@malditonekro
Copy link

Hi i have a question about the menu sidebar on ngx-admin.

I was trying to make the expand and collapse more intuitive bases on the last action made by the user, i mean if the user collapsed or compacted it, the next time he enters the page the sidebar will be collapsed or compacted. I made and idea of it but now i have troubles trying to avoid that when the user clicks a menu item to go to another section, if the menu sidebar was compacted then it expands. Thats a native action from the menu item component?. how can i avoid it from expanding when clicking a menu?

@Mr-Sloth
Copy link

Mr-Sloth commented Oct 17, 2017

At the moment from what I know you can set the default state, and you can set subMenus to auto collapse. For ur case there is no prebuild function inside of the code.

The function that expands the sidebar seems to be inside of the nebular package, which cant be changed easily by ourself.

Either you run the collapse function after the expand finished or eventually its possible to "unsubscribe" from the expand function.

It should be easy possible to make an onchange event for nb-sidebar with if class = expanded -> set class collapsed

@malditonekro
Copy link
Author

Ty for your answer @darklinki that helped me a lot.

At the moment im hiding the sidebar after the user select a menu item by subscribing to the MenuService's onItemSelect. Its ugly because it resizes the main layout content each time it expands so i have to make the sidebar hover it now i guess.

@nnixaa
Copy link
Collaborator

nnixaa commented Feb 16, 2018

Was fixed in Nebular@rc.5 akveo/nebular#158

@nnixaa nnixaa closed this as completed Feb 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants