Bug: TabMenu not allowing p:repeat

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

28 Dec 2016, 17:10

I have the following where I want to dynamically create menu items for timezones using <p:repeat>

Code: Select all

<pa:menu widgetVar="customize_menu">
   <p:submenu id="mnuTimezone" label="#{appmsg['customize.timezone']}" icon="fa fa-fw fa-clock-o">
      <p:repeat value="#{availableTimezones}" var="timezone">
         <p:menuitem value="#{timezone.label}" icon="fa fa-fw fa-clock-o"  actionListener="#{applicationUser.setTimezone(timezone.value)}"          ajax="false" />
      </p:repeat>
    </p:submenu>
...
And the Menu blows up with this stack trace:

Code: Select all

java.lang.ClassCastException: org.primefaces.component.repeat.UIRepeat cannot be cast to org.primefaces.model.menu.MenuElement
	at org.primefaces.atlantis.component.MenuRenderer.encodeElements(MenuRenderer.java:51)
	at org.primefaces.atlantis.component.MenuRenderer.encodeSubmenu(MenuRenderer.java:129)
	at org.primefaces.atlantis.component.MenuRenderer.encodeElement(MenuRenderer.java:89)
	at org.primefaces.atlantis.component.MenuRenderer.encodeElements(MenuRenderer.java:51)
	at org.primefaces.atlantis.component.MenuRenderer.encodeMarkup(MenuRenderer.java:41)
	at org.primefaces.component.menu.BaseMenuRenderer.encodeEnd(BaseMenuRenderer.java:114)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:920)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
	at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at org.primefaces.atlantis.component.TabMenuRenderer.encodeEnd(TabMenuRenderer.java:83)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:920)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

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

02 Jan 2017, 09:48

<pa:menu>, <pa:tabMenu> or <pa:tab> is not a PrimeFaces component. They are special components created for atlantis. Therefore, p:repeat is not supported by pa:menu. Maybe, you can use model attribute of pa:menu to create dynamic menu.

Post Reply

Return to “Atlantis - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests