p:menuitem and styleClass not behaving correctly

UI Components for JSF
Post Reply
PF1234AAG
Posts: 7
Joined: 24 Mar 2018, 01:33

17 Jan 2019, 19:54

Hi All, we are facing an issue with coloring items in a menu. The following code snippet has: styleClass="#{headerMB.getUserColor(person)}".
This returns 1 of 2 entries in our css (1 has a Red color, and 1 has a Blue color) Usually there are like 4 names, where 1 name is the primary user name (which must be blue) and the other user names are NOT primary users and must be Red. Then once you select another user, the Primary user needs to STILL be Blue but further down in the dropdown menu. The forEach used to color records appropriately, and we have confirmed that the correct css entry is being returned, but after you select another entry the items in the menu all turn Red and the styleClass fails to loop through and set the color correct.
This used to work in a previous version of primefaces but now it is broken.

Note that if I reselect the primary user, styleClass="#{headerMB.userColor}" picks up the Blue again, it is only once that user goes into the dropdown and hence is unselected does the Blue not hold for that user.

- Each menu item is a user.

<p:menubar>
<p:submenu label="#{headerMB.selectedUser.fullName}" styleClass="#{headerMB.userColor}">
<c:forEach items="#{headerMB.selectionUsers}" var="person">
<p:menuitem value="#{person.selectionName}" onstart="onStartUpdateEditor(noteWindow, false, wrkFlwDetailWindow);"
action="#{chapDocumentMB.onUserChange(person)}"
rendered="#{headerMB.hasViewHrgRightsCheckUser(person.prPrid)}" styleClass="#{headerMB.getUserColor(person)}"
oncomplete="!userEditActive ? refreshPageCmd() : '';"/>
</c:forEach>
</p:submenu>
</p:menubar>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 23 guests