[richfaces-issues] [JBoss JIRA] (RF-11021) rich:select should show first item in list if defaultLabel is not set

J W (JIRA) jira-events at lists.jboss.org
Fri Jun 28 09:37:21 EDT 2013


    [ https://issues.jboss.org/browse/RF-11021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12786186#comment-12786186 ] 

J W edited comment on RF-11021 at 6/28/13 9:35 AM:
---------------------------------------------------

How about something like this when the site gets called. It works fine for me:

if (this.defaultLabel == "") {
    var firstItem = this.clientSelectItems[0];
    var key = $(firstItem).attr("id");
    var label;
    $.each(this.clientSelectItems, function() {
        if (this.id == key) {
            label = this.label;
            return false;
        }
    });
    this.__setValue(label);
    this.__save();
    this.invokeEvent.call(this, "selectitem", document.getElementById(this.id));
}
                
      was (Author: jigg4):
    How about something like this when the site gets called:

 if (this.defaultLabel == "") {
     this.list.__selectByIndex(0);
 }
                  
> rich:select should show first item in list if defaultLabel is not set
> ---------------------------------------------------------------------
>
>                 Key: RF-11021
>                 URL: https://issues.jboss.org/browse/RF-11021
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-input
>    Affects Versions: 4.0.0.Final
>         Environment: GAE, Win7-64
>            Reporter: Ara Minosian
>              Labels: richfaces
>             Fix For: 5-Future
>
>
> This code does not display first value. Id displays emty item.
> {code:xml} 
> <rich:select id="unitSelect" value="#{editBean.paramEditor1.unitKeyWithRange}" selectFirst="true">
>     <f:selectItems value="#{editBean.paramEditor1.availableUnits}"/>
> </rich:select>
> {code} 
> This code dispays first value
> {code:xml} 
> <h:selectOneMenu id="unitSelect" value="#{editBean.paramEditor1.unitKeyWithRange}">
>     <f:selectItems value="#{editBean.paramEditor1.availableUnits}"/>
> </h:selectOneMenu>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the richfaces-issues mailing list