0 Replies Latest reply on Sep 11, 2007 1:32 PM by hager hager

    <s:selectItems and noSelectionLabel

    hager hager Newbie

      I have some problems with the noSelectionLabel attribute,

      I want to make a research by collaborator's type.
      collaborateur's type is a String
      for example : when i choose the type "interne" from the selectOneMenu, i obtain all collaborators which have intern type.
      my problem is, when i put the noSelectionLabel attribute, the research is wrong, but when i remove it, i have the appropriate collaborators.
      but i have to use the noSelectionLabel attribute.

      in page.xhtml

      <ui:define name="label">#{msgCollaborateur.type}</ui:define>
       <h:selectOneMenu id="selectOneType" value="#{collaborateurList.collaborateur.type}">
      <s:selectItems value="#{collaborateurHome.typeCollaborateurKeys}" var="typeCollaborateurIterator" label="#{collaborateurHome.typeCollaborateurMap[typeCollaborateurIterator]}"
      noSelectionLabel="all Types"/>

      in collaborateurHome.java:
      package com.fitnetapplication.resources.model;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityQuery;
      import java.util.List;
      import java.util.Arrays;
      public class CollaborateurList extends EntityQuery {
       Societe currentSociete;
       private static final String[] RESTRICTIONS = {
       "lower(collaborateur.type) like concat(lower(#{collaborateurList.collaborateur.type}),'%')",
       "lower(collaborateur.nom) like concat(lower(#{collaborateurList.collaborateur.nom}),'%')",
       "lower(collaborateur.prenom1) like concat(lower(#{collaborateurList.collaborateur.prenom1}),'%')",
       private Collaborateur collaborateur = new Collaborateur();
       public String getEjbql() {
       if(currentSociete != null){
       return "select collaborateur from Collaborateur collaborateur where collaborateur.societe = #{currentSociete}";
       return "select collaborateur from Collaborateur collaborateur";
       public Integer getMaxResults() {
       return 25;
       public Collaborateur getCollaborateur() {
       return collaborateur;
       public List<String> getRestrictions() {
       return Arrays.asList(RESTRICTIONS);
       @Override public List<Collaborateur> getResultList()
       List<Collaborateur> a=super.getResultList();
       System.out.println("EJBQL = " + super.getRenderedEjbql());
       return a;