rah*_*hul 0 ajax jsf primefaces
我有一种情况,我必须针对<pickList>
同一页面中的每个选择生成输入文本字段。我正在使用PrimeFaces 5.2和JSF 2.2。好心劝告。
答案如下:
XHTML:
<p:pickList id="PojoPickList"
value="#{editRoleAction.funcFieldDTO}" var="trnxDto"
effect="bounce" itemValue="#{trnxDto.fieldValue}"
itemLabel="#{trnxDto.fieldName}" showSourceControls="true"
showTargetControls="true" converter="pickListConverter">
<p:ajax event="transfer" update="@form"
listener="#{editRoleAction.transactionTransferToDestination}" />
<f:facet id="idar556" name="sourceCaption">#{msg.LBL_AVALIABLE_ROLES} </f:facet>
<f:facet id="idar557" name="targetCaption">#{msg.LBL_SELECTED_ROLES}</f:facet>
</p:pickList>
<h:panelGrid id="myGrid" width="400px;">
<p:dataTable value="#{editRoleAction.moduleTransactionList}" rendered="#{editRoleAction.moduleTransactionList.size() gt 0}" var="mainMenu">
<p:column>
<h:panelGrid columns="2">
<h:outputText value="Price of #{msg[mainMenu.labelId]}"/>
<p:inputText value="#{mainMenu.kioskType}"/>
</h:panelGrid>
</p:column>
</p:dataTable>
</h:panelGrid>
Run Code Online (Sandbox Code Playgroud)
Java:
public void transactionTransferToDestination() {
List<FunctionalityFieldDTO> destTrnx = funcFieldDTO.getTarget();
for (FunctionalityFieldDTO dto : destTrnx) {
moduleTransactionList.add(dto);
}
}
Run Code Online (Sandbox Code Playgroud)