1 Reply Latest reply on Mar 12, 2009 4:41 PM by francof

    Filtered list for s:convertEntity

      I am stuck on this for over a day now, so it is time to ask for help !



      itemTypeEdit.xhtml (backed by EntityHome)


      <s:label value="Default Location" />
      <h:selectOneMenu value="#{itemTypeHome.instance.location}" required="true" label="Default Location" id="location">
         <s:selectItems value="#{activeLocationList}" var="_location" 
           label="#{_location.locationName}" noSelectionLabel="[Select]"/>
        <s:convertEntity /> 
      </h:selectOneMenu>
      



      components.xml


      <framework:entity-query name="activeLocationList" 
         ejbql="select location from Location location" 
         order="location.locationName"  
         scope="conversation" />
      



      I have equals() and hashcode() on Location entity.


      This is the setup that works as expected - when I go to the itemTypeEdit.xhtml, all the locations are displayed in the ddl and if the default location had a prior value, it is automatically selected.
      Well, I do not want all locations to be displayed only the active locations, so I write 


      ejbql="select location from Location location where location.enabled = true" 




      now, when I call the edit page, the current value for default location is NOT automatically selected instead the noselectionlabel is chosen by default giving the impression that there is no prior value.


      I tried another approach and added a framework-restriction to the list


      where location.enabled = #{true}



      and that did not help.


      None of the Seam examples covered filtered lists, I looked at the UI, dvdstore examples.


      What am I missing ?



      Regards


      Franco