Menu Item regression issue - version 2.2-RC to 2.2-SNAPSHOT

UI Components for JSF
Post Reply
amanly
Posts: 16
Joined: 03 Feb 2011, 01:55

09 Feb 2011, 00:58

I have this bit of code:

Code: Select all

<p:accordionPanel activeIndex="0" autoHeight="false" collapsible="true">
	<p:tab title="Public">
		<p:menu effect="slide" style="display: inline-block;" >
			<p:submenu>
				<p:menuitem value="Welcome" url="#{facesContext.externalContext.requestServletPath}/welcome.xhtml"/>
			</p:submenu>
		</p:menu>
	</p:tab>
....
With prime faces version 2.2-RC it renders the menu component as expected. Here is the generated HTML:
<version>2.2-RC</version>

Code: Select all

<div id="j_idt1:j_idt92:j_idt93:j_idt95" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" role="tabpanel">
	<div style="display: inline-block; z-index: 0; position: static; visibility: visible;" class="ui-menu ui-widget ui-widget-content ui-corner-all yui-module yui-overlay visible" id="j_idt1:j_idt92:j_idt93:j_idt96">
		<div class="bd">
			<ul class="first-of-type">
				<li class="ui-menu-item ui-corner-all first-of-type" id="yui-gen0" groupindex="0" index="0">
					<a href="/ui/welcome.xhtml" class="ui-menu-item-label" id="j_idt1:j_idt92:j_idt93:j_idt98">Welcome</a>
				</li>
			</ul>
		</div>
	</div>
	<script type="text/javascript">widget_j_idt1_j_idt92_j_idt93_j_idt96 = new PrimeFaces.widget.Menu('j_idt1:j_idt92:j_idt93:j_idt96', {position:'static',effect: {effect: YAHOO.widget.ContainerEffect.slide,duration: 0.25}});widget_j_idt1_j_idt92_j_idt93_j_idt96.render();</script>
</div>
However I would like to use the <p:inputfield component and was advised to change my version of PF to version 2.2-SNAPSHOT. This has introduced a regression issue where the menu items are not rendered correctly. The menu item now look like basic HTML list items. Can anyone point out what I need to do to fix this menu item in version 2.2-SNAPSHOT or do I need to wait for version 3.0 in 2 months time? Here is the generate HTML for version 2.2-SNAPSHOT.

<version>2.2-SNAPSHOT</version>

Code: Select all

<div id="j_idt1:j_idt130:j_idt131:j_idt133" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" role="tabpanel">
	<span id="j_idt1:j_idt130:j_idt131:j_idt134">
		<ul id="j_idt1:j_idt130:j_idt131:j_idt134_menu">
			<li>
				<h3 style="padding: 0px;"></h3>
			</li>
			<li>
				<a href="/ui/welcome.xhtml">
					<span class="wijmo-wijmenu-text">Welcome</span>
				</a>
			</li>
		</ul>
	</span>
	<script type="text/javascript">widget_j_idt1_j_idt130_j_idt131_j_idt134 = new PrimeFaces.widget.Menu('j_idt1:j_idt130:j_idt131:j_idt134',{position:'static',zindex:1,animated:'slide',style:'display: inline-block;'});</script>
</div>
Is this a bug or is there a problem with my code?

Thanks in advance

amanly
Posts: 16
Joined: 03 Feb 2011, 01:55

09 Feb 2011, 02:38

I have also tested this with <version>2.2</version> and get the same error. The menu item only seems to render correctly with RC2.

brazzy
Posts: 23
Joined: 23 Dec 2010, 12:55

09 Feb 2011, 13:40

It seems <p:menu> was completely rewritten between 2.2 RC2 and 2.2 final, and now lacks some functionality it had before (namely, styleClass and id attributes are not supported at all anymore) as well as generating different HTML

What I did to fix this is replace the MenuRenderer:

Code: Select all

<render-kit>
        <renderer>
            <component-family>org.primefaces.component</component-family>
            <renderer-type>org.primefaces.component.MenuRenderer</renderer-type>
            <renderer-class>fully qualified implementation class</renderer-class>
        </renderer>
</render-kit>
with a class that extends org.primefaces.component.menu.MenuRenderer and overwrites encodeMenuItem(FacesContext context, MenuItem menuItem)
  • Primefaces 2.2RC2 / 2.2 Final
  • Myfaces 2.0.2
  • Facelets
  • Tomcat 7.0.5

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

09 Feb 2011, 17:28


Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests