You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Joe Rossi (Commented) (JIRA)" <de...@myfaces.apache.org> on 2011/10/24 16:43:32 UTC

[jira] [Commented] (MYFACES-3370) f:selectItem ignores rendered attribute

    [ https://issues.apache.org/jira/browse/MYFACES-3370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13134111#comment-13134111 ] 

Joe Rossi commented on MYFACES-3370:
------------------------------------

Culprit appears to be org.apache.myfaces.shared.util.SelectItemsIterator.hasNext():


            if (child instanceof UISelectItem)
            {
                UISelectItem uiSelectItem = (UISelectItem) child;
                Object item = uiSelectItem.getValue();
                if (item == null)
                {
                    // no value attribute --> create the SelectItem out of the other attributes
                    Object itemValue = uiSelectItem.getItemValue();
                    String label = uiSelectItem.getItemLabel();
                    String description = uiSelectItem.getItemDescription();
                    boolean disabled = uiSelectItem.isItemDisabled();
                    boolean escape = uiSelectItem.isItemEscaped();
                    boolean noSelectionOption = uiSelectItem.isNoSelectionOption();
                    if (label == null)
                    {
                        label = itemValue.toString();
                    }
                    item = new SelectItem(itemValue, label, description, disabled, escape, noSelectionOption);
                }
                else if (!(item instanceof SelectItem))
                {
                    ValueExpression expression = uiSelectItem.getValueExpression("value");
                    throw new IllegalArgumentException("ValueExpression '"
                            + (expression == null ? null : expression.getExpressionString()) + "' of UISelectItem : "
                            + RendererUtils.getPathToComponent(child) + " does not reference an Object of type SelectItem");
                }
                _nextItem = (SelectItem) item;
                return true;
            }


Shouldn't it ignore the child if it's rendered attribute evaluates to false?
                
> f:selectItem ignores rendered attribute
> ---------------------------------------
>
>                 Key: MYFACES-3370
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3370
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.0.9
>         Environment: Jetty 6, Myfaces 2.0.9, Primefaces 3.0
>            Reporter: Joe Rossi
>            Priority: Minor
>
> In the following snippet:
>         <h:selectOneMenu id="selector"
>           value="#{cc.attrs.backingBean[cc.attrs.property]}"
>           required="#{cc.attrs.required}"
>           requiredMessage="#{cc.attrs.requiredMessage}"
>           disabledClass="tnui-selectDisabled"
>           disabled="#{cc.attrs.disabled}"
>           immediate="#{cc.attrs.immediate}"
>           readonly="#{cc.attrs.readonly}"
>           onchange="#{cc.attrs.onchange}"
>           style="#{cc.attrs.style}">
>           <f:selectItem
>             itemLabel="#{cc.attrs.noSelectOptionLabel}#{sessionBean.classOfService}"
>             itemValue="#{null}"
>             noSelectionOption="true"
>             rendered="false"/>
>           <p:ajax update="#{cc.attrs.updateTargets}" disabled="#{!includeAjaxUpdate}"/>
>           <composite:insertChildren />
>         </h:selectOneMenu>
> The embedded f:selectItem is always included even though it's rendered attribute is set to false.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira