I need to update data in bean without reload page. Solution with p:ajax is working only outside <p:dataTable>.
Not working code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb"
xmlns:ui="http://ift.tt/KsEgXx"
xmlns:f="http://ift.tt/HcrI1S"
xmlns:h="http://ift.tt/HjFrZb"
xmlns:c="http://ift.tt/QfKAz6"
xmlns:p="http://ift.tt/HjFrZc">
<h:head></h:head>
<h:body>
<ui:composition template="/templates/default.xhtml">
<ui:define name="content">
<!-- WORKING CODE -->
<p:selectOneMenu value="#{bean.option}" var="#{bean.option}">
<f:selectItem itemValue="1" itemLabel="1" />
<f:selectItem itemValue="2" itemLabel="2" />
<f:selectItem itemValue="3" itemLabel="3" />
<p:ajax event="change" listener="#{bean.changeListernMethod}" />
</p:selectOneMenu>
<f:metadata>
<f:viewParam name="mapperId" value="#{bean.id}" />
</f:metadata>
<br />
ID: <h:outputText value="#{param['id']}" />
<h:form id="form">
<p:dataTable value="#{bean.current}"
var="var">
<p:column headerText="Source field">
<h:inputText id="fsrc" value="#{var.field_src}">
</h:inputText>
</p:column>
<p:column headerText="Condition">
<!-- NOT WORKING CODE -->
<p:selectOneMenu id="optionMenu" value="#{bean.option}"
var="#{bean.option}">
<p:ajax listener="#{bean.changeListernMethod}" render="@form" event="valueChange"/>
<f:selectItem itemValue="1" itemLabel="1" />
<f:selectItem itemValue="2" itemLabel="2" />
<f:selectItem itemValue="3" itemLabel="3" />
</p:selectOneMenu>
</p:column>
<p:column headerText="Target field">
<h:inputText id="ftgt" value="#{var.field_tgt}">
</h:inputText>
</p:column>
</p:dataTable>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
Code outside dataTable is working and listener is called. Inside dataTable i cannot call listener and refresh bean values. Can you help?
Aucun commentaire:
Enregistrer un commentaire