Strange menu behavior (solved)

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
serenne
Posts: 98
Joined: 21 Jul 2015, 07:43

13 Aug 2017, 14:19

From <menu.xhtml, I changed the menu to : <pu:menu widgetVar="module" model="#{sideMenuModel.model}"/> (org.primefaces.model.menu.MenuModel)

My menu model has Submenus having items (dynamically created in java).

The problem is with the current item highlited after having select one : somteimes it' OK (the selmected item is the one hihlited), sometimes (very often indeed) another item is higlited instead of the current selected one.

You will find below a small video showing that ( perahaps better than a long pdf ...)
http://37.187.93.92/pbMenu.webm

I think I miss something that will be evident to you !!

Kindest regards
Philippe
Last edited by serenne on 27 Aug 2017, 18:49, edited 1 time in total.

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

14 Aug 2017, 10:39

For stateful feature on menu, all menuitems and submenuitems need to have different ids in model. Please check it. Then, please clear browser cache and try again.

serenne
Posts: 98
Joined: 21 Jul 2015, 07:43

14 Aug 2017, 14:16

Hi Aragorn?.
*
I am currently using the DynamicMenuModel.generateUniqueIds() at the end of menuModel creation.

I check with the debugger to have a look on the model, all seems fine :
level1 item have ids 1,2,3,4,,...
and sub menu items : 1_0, 1_1,...
and for the Missions subMenu (3), items are 3_1,3_2,3_3 and their children 3_1_1, 3_1_1, and so on ...

One thing I have noticed :
- Each time I log out and log in (so the menu model is recreated) the menu item highlighted is the last one highlighted before login out and in (even if the main page is the dashboard :ok)

- If I close the browser, reopen it, log in : the menu is collapsed : ok
- open a submenu, click on one item : The main changes (ok) but the menu collapses alone(always reproduce)
- If I do the same thing a second time (re open the submenu, click on one item) , then it is ok, the submenu stays expanded and the menu Item highlighted.


Kindest regards and again thanks for your help
Philippe

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

18 Aug 2017, 09:57

You can try to call PF('mainmenu').clearMenuState() after clicking logout button/link;

Code: Select all

<pu:menu widgetVar="mainmenu">
  ...
</pu:menu>
in topbar.xhtml

Code: Select all

..
xmlns:p="http://primefaces.org/ui"
xmlns:jsf="http://xmlns.jcp.org/jsf">
...
<li role="menuitem">
    <a href="#" jsf:action="#{bean.logout}">
        <i class="material-icons">&#xE8AC;</i>
        <span>Logout</span>
    </a>
</li>
...
More information is at;
https://www.beyondjava.net/blog/jsf-2-2 ... eat-sheet/
http://www.oracle.com/technetwork/artic ... 27136.html

serenne
Posts: 98
Joined: 21 Jul 2015, 07:43

18 Aug 2017, 14:53

Thanks, it works for the logout/login case.

But I still have the original problem (http://37.187.93.92/pbMenu.webm). Any other so good idea for that !

kindest regards
Philippe

serenne
Posts: 98
Joined: 21 Jul 2015, 07:43

24 Aug 2017, 03:04

Another idea that perhaps may help ... :

The first time I expand a DefaultSubMenu and then select an item, the menu get collapsed (the opened defaultSubMenu gets collapsed) . The seond time it stays open

Hope this may help.

Just tell me if yo need the code ...

serenne
Posts: 98
Joined: 21 Jul 2015, 07:43

27 Aug 2017, 18:51

Hi aragron
Solved adding an id for the pu:menu component in xhtml instead of the default jsf id generation ... Hope this could help !!

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

13 Sep 2017, 10:05

Glad to hear, thanks a lot for the update!

Post Reply

Return to “Ultima - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests