-
1. Re: a4j support and dynamically generated component
sergeysmirnov May 30, 2008 12:34 PM (in response to sambolino)you have an onchange="submit()" for selectOneMenu that produces non-Ajax request. At the same time, you attach a4j:support on the same event. This will cause double (ajax and non-ajax) requests with unpredictable result.
-
2. Re: a4j support and dynamically generated component
sambolino Jun 2, 2008 10:08 AM (in response to sambolino)i've changed code a bit according to richfaces demo
<a4j:outputPanel layout="block"> <a4j:outputPanel ajaxRendered="true"> <h:messages globalOnly="true" styleClass="message" /> </a4j:outputPanel> <a4j:outputPanel layout="block"> <h:form> <f:facet name="header"> <h:outputText value="Add new address" /> </f:facet> <h:selectOneMenu id="addressTypesSelectOne" styleClass="selectOneMenu" value="${addressService.spatialAddressType}"> <s:selectItems value="#{addressBinder.allSpatialAddressTypes}" var="result" label="#{result.name}" noSelectionLabel="#{messages['select']}" /> <s:convertEntity /> <a4j:support event="onchange" reRender="out1" action="#{addressService.resetAllUnits}"></a4j:support> </h:selectOneMenu> <h:commandButton action="selectAddressType" value="Select address type" /> </h:form> </a4j:outputPanel> <a4j:outputPanel id="out1" > <h:panelGrid columns="1" binding="#{addressLinker.generatedPanel}" ></h:panelGrid> </a4j:outputPanel> </a4j:outputPanel>
now, rerender happens, selectOneMenu sets value to the bean and a4j:support action is called. still, binding on the panelGrid is only called when i manually hit the button or refresh the page. i couldn't find an attribute which would tell "bind on every request" or so.
thanks -
3. Re: a4j support and dynamically generated component
ilya_shaikovsky Jun 3, 2008 3:21 AM (in response to sambolino)addressLinker - should be request scoped.
-
4. Re: a4j support and dynamically generated component
sambolino Jun 3, 2008 5:08 AM (in response to sambolino)i'm using seam:
@Stateless
@Scope(ScopeType.STATELESS)
@Name("addressLinker")
i've also tried to put it as a managed bean (but still keeping seam annotations in the code)
<managed-bean-name>addressLinker</managed-bean-name>
<managed-bean-class>com.advsofttech.registeroffice.logic.AddressLinkerBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
doesn't work this way either -
5. Re: a4j support and dynamically generated component
sambolino Jun 3, 2008 6:05 AM (in response to sambolino)if i put static content inside "out1" a4j:outputpanel it works. seems like ajax doesn't work with component which is dynamically bound. is there a workaround more elegant than refreshing the UIViewRoot (because defining navigation rule that rerenders the whole page results in unexpected behavior).