a4j:support migration to a4j:ajax
spinacz Sep 25, 2012 8:59 AMHi,
I update application to the latest libraries and i have problem with migration to RF4
My old pice of code:
<div id="sort_by_wrapper"><h:outputLabel for="sort_it_by"><span>Sortuj wg:</span></h:outputLabel> <h:selectOneMenu id="sort_it_by" value="#{bean.orderBy}"> <a4j:support event="onchange" reRender="output,sortDescription,jsPanel" action="#{bean.sort}"/> <f:selectItem itemLabel="v1" itemValue="99"/> <f:selectItem itemLabel="v2" itemValue="#{2}"/> <f:selectItem itemLabel="v3" itemValue="#{1}"/> <f:selectItem itemLabel="v4" itemValue="#{0}"/> </h:selectOneMenu> </div>
it was working ok,
How should i change this code to work with RF4.2 and JSF2
I try in this way, but no effects.
<div id="sort_by_wrapper"><h:outputLabel for="sort_it_by"><span>Sortuj wg:</span></h:outputLabel> <h:selectOneMenu id="sort_it_by" value="#{bean.orderBy}" onchange="submit()" valueChangeListener="#{bean.sortJSF2}"> <!-- <f:ajax event="valueChange" listener="#{bean.sortAjaxJSF2}" execute="@this" render="@form" /> --> <a4j:ajax event="change" render="output,sortDescription,jsPanel" listener="bean.sortRF4" execute="@this, sort_by_wrapper" /> <f:selectItem itemLabel="v1" itemValue="99"/> <f:selectItem itemLabel="v2" itemValue="#{2}"/> <f:selectItem itemLabel="v3" itemValue="#{1}"/> <f:selectItem itemLabel="v4" itemValue="#{0}"/> </h:selectOneMenu> </div>
public void sortJSF2(ValueChangeEvent event){ //TODO test println System.err.println("sortJSF2(ValueChangeEvent event)"); this.orderBy = (Long) event.getNewValue(); this.sort(); } public void sortRF4(/*ActionEvent event*/){ //TODO test println System.err.println("sortRF4(ActionEvent event)"); this.sort(); } public void sortAjaxJSF2(AjaxBehaviorEvent event){ //TODO test println System.err.println("sortAjaxJSF2(AjaxBehaviorEvent event)"); //this.orderBy = (Long) event.getNewValue(); this.sort(); }
Without ajax code it works with valueChangeEvent ok, but with a4j:ajax and f:ajax do not perform listener method.
I checked template, I have h:head, h:body and h:form tags, h:form is no nested in another h:form
regards
sory for my english
Message was edited by: Krzysiek Nieszporek