ICEfaces
  1. ICEfaces
  2. ICE-9772

ace:selectMenu - not showing the selected item if it is the last item of the list

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3
    • Fix Version/s: None
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Glassfish 3.1.2.2

      Description

      Maybe depends on Ticket ICE-9510.

      Running the sample code below no item is selected initially.

      import java.util.List;
      import javax.faces.bean.ManagedBean;
      import javax.faces.bean.SessionScoped;
      import javax.faces.model.SelectItem;

      @ManagedBean
      @SessionScoped
      public class Bean {

          private String value = "Three";
          private List<SelectItem> items = java.util.Arrays.asList(new SelectItem("One") ,new SelectItem("Two"), new SelectItem("Three"));

          public String getValue() {
              return value;
          }

          public void setValue(String value) {
              this.value = value;
          }

          public List<SelectItem> getItems() {
              return items;
          }

          public void setItems(List<SelectItem> items) {
              this.items = items;
          }
      }


      <?xml version='1.0' encoding='UTF-8' ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ace="http://www.icefaces.org/icefaces/components"
            xmlns:h="http://java.sun.com/jsf/html">
          <h:head></h:head>
          <h:body>
              <h:form>
                  <ace:selectMenu value="#{bean.value}">
                      <f:selectItems value="#{bean.items}"/>
                  </ace:selectMenu>
                  <h:inputText />
              </h:form>
          </h:body>
      </html>

        Activity

        Hide
        F Lupke added a comment -

        It seems that setting the last item as selected item is not possible programmatically. If the user has selected the last item, it is set in the model, but after reentering the page (refresh F5 or navigating back to the page), the model value is lost, if and only if the last item was selected.

        Show
        F Lupke added a comment - It seems that setting the last item as selected item is not possible programmatically . If the user has selected the last item, it is set in the model, but after reentering the page (refresh F5 or navigating back to the page), the model value is lost, if and only if the last item was selected.

          People

          • Assignee:
            Unassigned
            Reporter:
            F Lupke
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: