[richfaces-issues] [JBoss JIRA] Created: (RF-8054) Richfaces menu item opens new window when styleClass is set

Maksim Kaszynski (JIRA) jira-events at lists.jboss.org
Thu Oct 29 14:05:05 EDT 2009


Richfaces menu item opens new window when styleClass is set
-----------------------------------------------------------

                 Key: RF-8054
                 URL: https://jira.jboss.org/jira/browse/RF-8054
             Project: RichFaces
          Issue Type: Bug
          Components: component-menu
    Affects Versions: 3.3.1
         Environment: FF 3.5
            Reporter: Maksim Kaszynski


When rich:menuItem has styleClass attrribute set, but no target set, clicking item forces new window/tab open

Following code

<rich:menuItem value="#{participant.name}" 
										action="#{participantImageDisplayBBean.load}"
										styleClass="#{i0.first ? 'first' : ''} #{i0.last ? 'last' : ''}">

Results in rendering 

RichFaces.Menu.submitForm(
	event,
	this,
	{'left\x2Dmenu\x2Dform:j_id111':'28','left\x2Dmenu\x2Dform:j_id112':'2'},
	{styleClass:' '})

However, method signature is

RichFaces.Menu.submitForm = function (event, element, params, target, attr) {

Thus, {styleClass:' '} is used as target.

target should be null when no target is specified.

So far I see 2 solutions, 
either make target attribute for menuItem to have default value _self  (probably, regression testing needed)
or, change the code in org.richfaces.renderkit.html.MenuItemRendererBase starting at line 268

    	        String target = (String) menuItem.getAttributes().get("target");
    	        if (null != target && target.length()>0) {
    	        	scriptValue.append(",");
    	 			scriptValue.append(ScriptUtils.toScript(target));
    	        }
  to 

    	        String target = (String) menuItem.getAttributes().get("target");
    	        scriptValue.append(",");
    	 		scriptValue.append(ScriptUtils.toScript(target));




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list