creativetimofficial/ct-vue-material-dashboard-pro

Automatically collapse top-menu items when other top-menu item is opened

fecilak opened this issue · 4 comments

I'd like to ask you for help in setting-up menu so the top-level menu items (groups containing other items/links) will get automatically collapsed when the new top-menu item is opened.

E.g. in left-menu I have:

  • Dashboard
  • Profile (top level group)
    --- Voltage
    --- Current
  • Energy (top level group)
    --- Phase 1
    --- Phase 2
    --- Phase 3

Default setup of the menu is that top level groups in menu are expanding/collapsing by clicking on it and there may be multiple top level groups opened.

What I'd like to achieve is that there may be only 1 top level menu opened at a time and all other should collapse automatically when expanding new one. However, when clicking on the link in the menu (e.g. --- Phase 1, --- Current), it should not collapse.

Hi, @fecilak! I tried to find a solution for this feature, but It seems that is a little complex. We will come back with a solution soon.

Regards,
Dragos

Hi, @fecilak! Please see this link to make the collapse as you requested.

https://www.dropbox.com/s/3nx8ddwu9zf8k6g/vuemdpro-collapse.mov?dl=0

Regards,
Dragos

Thank you very much, it works except of automatically collapsing when I click on "dashboard" link which is not representing the "group" but rather a direct link from the top menu.
Would it be possible to collapse also when I'll click on "Dashboard"?

Thank you in advance.

Best regards,
Peter

Hi! Yes, you are right. All you need to do is to add the following:

Screenshot 2019-09-10 at 10 53 17

Regards,
Dragos