ajax - p:selectOneRadio does not work the first time -
i have problem selectoneradio id="idesito"
of code. in fact first time click on it, java method specified listener attribute not called, instead successive times called correctly
<h:form id="switchform"> <pf:panelgrid id="srinfopanel" styleclass="gridnoborder centered" style="width:100%;" rendered="#{switchufficioservice.selectedsub != null}"> <pf:row> <pf:column colspan="10" styleclass="fondogreendark"> <pf:outputlabel id="titoloriepilogo" styleclass="captionmaschera" value="riepilogo dati switch" /> </pf:column> </pf:row> <pf:row> <pf:column> <pf:panelgrid id="infocedpanel" styleclass="gridnoborder centered" style="width:100%;"> <pf:row> <pf:column colspan="4"> <br /> </pf:column> </pf:row> <pf:row> <pf:column colspan="4" styleclass="fondogreendark"> <pf:outputlabel id="cedtitle" style="margin-bottom:10px; text-align:center;" styleclass="captionmaschera" value="anagrafica cedente" /> </pf:column> </pf:row> <pf:row> <pf:column colspan="4"> <br /> </pf:column> </pf:row> <pf:row> <pf:column style="width:20%;"> <pf:outputlabel styleclass="testodati" value="codice fiscale:" /> </pf:column> <pf:column style="width:30%;"> <h:inputtext styleclass="testoinput" disabled="true" value="#{switchufficioservice.selectedced.cofis}" /> </pf:column> <pf:column style="width:20%;"> <pf:outputlabel styleclass="testodati" value="partita iva:" /> </pf:column> <pf:column style="width:30%;"> <h:inputtext styleclass="testoinput" disabled="true" value="#{switchufficioservice.selectedced.piva}" /> </pf:column> </pf:row> <pf:row> <pf:column style="width:20%;"> <pf:outputlabel styleclass="testodati" value="ragione sociale:" /> </pf:column> <pf:column style="width:30%;"> <h:inputtext styleclass="testoinput" disabled="true" value="#{switchufficioservice.selectedced.ragsoc}" /> </pf:column> <pf:column style="width:20%;"> <pf:outputlabel styleclass="testodati" value="tipo soggetto responsabile:" /> </pf:column> <pf:column style="width:30%;"> <h:inputtext styleclass="testoinput" disabled="true" style="width:75%;" value="#{switchufficioservice.selectedced.tipologiagiuridica}" /> </pf:column> </pf:row> </pf:panelgrid> </pf:column> </pf:row> <pf:row> <pf:column> <pf:panelgrid id="infosubpanel" rendered="#{switchufficioservice.visualizzainfosrsub}" styleclass="gridnoborder centered" style="width:100%;"> <pf:row> <pf:column colspan="4" styleclass="fondogreendark"> <pf:outputlabel id="subtitle" style="margin-bottom:10px; text-align:center;" styleclass="captionmaschera" value="anagrafica subentrante" /> </pf:column> </pf:row> <pf:row> <pf:column colspan="4"> <br /> </pf:column> </pf:row> <pf:row> <pf:column style="width:20%;"> <pf:outputlabel styleclass="testodati" value="codice fiscale:" /> </pf:column> <pf:column style="width:30%;"> <h:inputtext disabled="true" styleclass="testoinput" value="#{switchufficioservice.selectedsub.codicefiscale}" /> </pf:column> <pf:column style="width:20%;"> <pf:outputlabel styleclass="testodati" value="partita iva:" /> </pf:column> <pf:column style="width:30%;"> <h:inputtext disabled="true" styleclass="testoinput" value="#{switchufficioservice.selectedsub.partitaiva}" /> </pf:column> </pf:row> <pf:row> <pf:column style="width:20%;"> <pf:outputlabel styleclass="testodati" value="ragione sociale:" /> </pf:column> <pf:column style="width:30%;"> <h:inputtext disabled="true" styleclass="testoinput" value="#{switchufficioservice.selectedsub.ragsoc}" /> </pf:column> <pf:column style="width:20%;"> <pf:outputlabel disabled="true" styleclass="testodati" value="tipo soggetto responsabile:" /> </pf:column> <pf:column style="width:30%;"> <h:inputtext disabled="true" styleclass="testoinput" style="width:75%;" value="#{switchufficioservice.selectedsub.descrtipo}" /> <br /> </pf:column> </pf:row> </pf:panelgrid> </pf:column> </pf:row> <pf:row> <pf:column> <pf:panelgrid styleclass="gridnoborder centered" style="width:100%;"> <pf:row> <pf:column style="width:30%;"> <pf:outputlabel styleclass="testodati" value="inserire la tipologia di soggetto responsabile: " /> </pf:column> <pf:column> <pf:selectoneradio id="idesito" style="width: 190px" value="#{switchufficioservice.tipologiasubentrante}"> <f:selectitems value="#{switchufficioservice.tipologicasubentrante}" /> <pf:ajax event="click" listener="#{switchufficioservice.loadsoggettodata}" update="inputsrpanel" /> </pf:selectoneradio> </pf:column> </pf:row> </pf:panelgrid> </pf:column> </pf:row> <pf:row> <pf:column> <pf:panelgrid id="inputsrpanel" style="width:100%;" styleclass="gridnoborder centered"> <pf:row id="soggettonazionalerow" rendered="#{switchufficioservice.tipologiasubentrante == 'n'}"> <pf:column> <ui:include src="soggettonazionalepanel.xhtml"> <ui:param name="suffisso" value="int" /> </ui:include> </pf:column> </pf:row> <pf:row id="soggettoesterorow" rendered="#{switchufficioservice.tipologiasubentrante == 'e'}"> <pf:column> <ui:include src="soggettoesteropanel.xhtml"> <ui:param name="suffisso" value="ext" /> </ui:include> </pf:column> </pf:row> </pf:panelgrid> </pf:column> </pf:row> <pf:row> <pf:column> <ui:include src="../../frags/contratti/switchnotedoc.xhtml"></ui:include> <br /> <br /> </pf:column> </pf:row> <pf:row> <pf:column align="center"> <pf:commandbutton id="eseguiswitch" value="esegui switch" type="button" styleclass="commandbutton" onclick="updateconfirm();"> <pf:remotecommand name="updateconfirm" actionlistener="#{switchufficioservice.verificapreinvio}" update="confermaswitch, :messagebox" /> </pf:commandbutton> <pf:confirmdialog message="#{switchufficioservice.confirmmessage}" id="confermaswitch" widgetvar="confermaswitch" header="conferma switch" severity="alert" dynamic="true" showeffect="fade" hideeffect="explode" width="400px"> <h:panelgroup layout="block" style="text-align: center;"> <pf:commandbutton value="si" process="@this" immediate="true" type="submit" ajax="false" action="#{switchufficioservice.eseguiswitch}" oncomplete="alert('switch effettuato con successo')" onclick="massivepublishconfirmation.hide();" onstart="primefaces.monitordownload(start, stop)" styleclass="ui-confirmdialog-yes" icon="ui-icon-check" /> <pf:commandbutton value="no" type="button" onclick="confermaswitch.hide()" styleclass="ui-confirmdialog-no" icon="ui-icon-close" /> </h:panelgroup> </pf:confirmdialog> <pf:commandbutton value="pulisci" type="submit" ajax="false" id="idpuliscitutto" action="#{switchufficioservice.clearswitchall}" onclick="primefaces.monitordownload(start, stop)" /> <pf:commandbutton value="indietro" type="submit" ajax="false" id="idindietro" action="#{switchufficioservice.indietroswitch}" onclick="primefaces.monitordownload(start, stop)" /> </pf:column> </pf:row> </pf:panelgrid> </h:form>
this method called when listener triggered :
public void loadsoggettodata(ajaxbehaviorevent event){ log.debug("entrato in loadsoggettodata =======> tipologia subentrante: {}", tipologiasubentrante); log.debug("info sull'evento: {}, {} ",event.getbehavior(), event.getclass()); if(stringutils.equals(tipologiasubentrante,"n")) { soggettosu = caricasoggettonazionale(this.selectedsub.getgblid()); } else { soggettosu.clear(); } }
the idea selecting radiobutton can load data db , after open different panel, depending on selected button.
it works after second "click". searched forum didn't find equal problem. `
Comments
Post a Comment