-
1. Re: Ajax4JSF and s:selectItems
damianharvey Aug 17, 2007 12:55 PM (in response to pdhaigh)reRender="dothis" should be all that is required.
Cheers,
Damian. -
2. Re: Ajax4JSF and s:selectItems
pdhaigh Aug 17, 2007 1:01 PM (in response to pdhaigh)no joy...
it is re-rendering this part correctly:<h:outputText value="Region: #{pressArticle.region.name}" rendered="#{pressArticle.region!=null}"/>
so the problem isn't that it's not rerendered the section, but that it's not re-evaluating the value set in the drop down -
3. Re: Ajax4JSF and s:selectItems
smithbstl Aug 17, 2007 2:29 PM (in response to pdhaigh)agreed, all you should be rerendering is "dothis"
Here is an example that I know works from my app<h:selectOneMenu id="departmentCode_select" value="#{departmentCode}"> <s:selectItems label="#{deptCode.department.departmentNumber} - #{deptCode.department.departmentName}" value="#{departmentCodeList}" noSelectionLabel="(None)" var="deptCode"/> <s:convertEntity/> <a4j:support event="onchange" actionListener="#{serviceRequestManager.fillDepartmentSectionList}" ajaxSingle="true" reRender="departmentSection_select"/> </h:selectOneMenu> <h:outputLabel for="departmentSection_select" value="#{messages['AssignmentList.departmentSection']}"/> <h:selectOneMenu id="departmentSection_select" value="#{departmentSection}"> <s:selectItems label="#{deptSection.departmentSectionName}" value="#{departmentSectionList}" noSelectionLabel="(None)" var="deptSection"/> <s:convertEntity/> </h:selectOneMenu>
-
4. Re: Ajax4JSF and s:selectItems
pdhaigh Aug 19, 2007 4:59 AM (in response to pdhaigh)Hi guys,
yes, i had tried that too. Here's a stripped down example:<h:form> <f:facet name="afterInvalidField"> <h:panelGroup><br/><s:message/></h:panelGroup> </f:facet> <f:facet name="aroundInvalidField"> <s:span styleClass="error"/> </f:facet> <s:validateAll> <h:panelGrid columns="2" columnClasses="object,value"> <h:outputText value="Destination: "/> <s:decorate> <h:selectOneMenu value="#{feedback.destination}" required="true" > <s:selectItems value="#{destinations.resultList}" var="destination" label="#{destination.name}" noSelectionLabel="Please select"/> <s:convertEntity/> <a4j:support ajaxSingle="true" event="onchange" actionListener="#{feedbackManager.setDestination}" reRender="regionmenu"/> </h:selectOneMenu> </s:decorate> <s:decorate> <h:selectOneMenu id="regionmenu" value="#{feedback.region}" required="true" disabled="#{feedback.destination!=null}" > <s:selectItems value="#{regions.resultList}" var="region" label="#{region.name}" noSelectionLabel="Please select"/> <s:convertEntity/> </h:selectOneMenu> </s:decorate> </h:panelGrid> </s:validateAll> </h:form>
does not work. However, changing the disabled parameter todisabled="#{feedback.destination==null}"
makes it work (although of course this isn't much help)
Removing the disabled statement completely does not work.
cheers
p -
5. Re: Ajax4JSF and s:selectItems
damianharvey Aug 19, 2007 10:42 AM (in response to pdhaigh)How does the regions bean get the value of feedback.destination? Do you inject feedbackManager?
-
6. Re: Ajax4JSF and s:selectItems
pdhaigh Aug 19, 2007 12:36 PM (in response to pdhaigh)not sure I understand your question...? regions is an entityquery defined in components.xml
<fwk:entity-query name="regions"> <fwk:ejbql>from Region</fwk:ejbql> <fwk:order>name</fwk:order> </fwk:entity-query>
Feedback is a model class that has references to a region (instance of Region model class) and destination (instance of Destination model class). -
7. Re: Ajax4JSF and s:selectItems
damianharvey Aug 19, 2007 4:23 PM (in response to pdhaigh)I misunderstood what you were trying to do. You aren't trying to re-query regions you are only trying to enable the regions drop-down and (stating the obvious) your problem is that destination in the feedback bean is always null.
Is the feedBack bean scoped so that it is maintained over the request? Try scoping it to a conversation and adding a begin-conversation to the page.xml. Also ensure that if you are setting the value of destination in feedbackManager that you are outjecting it.
Cheers,
Damian. -
8. Re: Ajax4JSF and s:selectItems
pdhaigh Aug 19, 2007 4:29 PM (in response to pdhaigh)hi,
actually, the destination on the feedback bean is being correctly set, as indeed is the region (if I add in some outputText fields and get them to be re-rendered it shows the correct values).
The problem is just that the selected value in the drop down is not being updated on re-render. I have used this functionality before with no problem, (although that was with textual value in the drop down, rather than seam converted entities) so I'm not sure what exactly is going wrong.
cheers
phil -
9. Re: Ajax4JSF and s:selectItems
pmuir Aug 20, 2007 5:43 PM (in response to pdhaigh)You should post on the ajax4jsf forum as well, as I don't *think* this is related to Seam.