以下是根据p:pickList
对象在ui:repeat
内创建Analysis
的代码:
<ui:repeat value="#{section.questions}" var="question" varStatus="qStatus">
<h:form id="questionForm#{qStatus.index+1}">
<p:fieldset style="border:none; " rendered="#{question.questionType.titleId eq 'OrderList'}">
<div class="ui-grid-row">
<div class="ui-grid-col-12 questionText">
<strong>#{qStatus.index+1}.</strong>
<h:outputText value="#{ question.questionText}" />
</div>
</div>
<div class="ui-grid-row">
<div class="ui-grid-col-12">
<p:pickList id="orderQuestionPickList#{qStatus.index+1}" styleClass="dutyPickList" responsive="true" showTargetControls="true"
value="#{analysisBean.sampleDualList}" var="option" itemLabel="#{option.text}" itemValue="#{option}" converter="#{itemConverter}" >
<f:facet name="sourceCaption">Tüm Şıklar</f:facet>
<f:facet name="targetCaption">Seçilen Şıklar</f:facet>
<p:ajax event="transfer" listener="#{analysisBean.onPickListTransfer}" />
</p:pickList>
</div>
</div>
</p:fieldset>
</h:form>
</ui:repeat>
和豆:
public void onPickListTransfer(TransferEvent event) {
System.out.println("asd");
int totalItemsNumber = 0;
DualListModel<Option> dualListModel = (DualListModel<Option>) getDualListOfOptions(new ArrayList<Option>());
if (dualListModel != null) {
totalItemsNumber = dualListModel.getTarget().size();
}
}
当我在ui:repeat
之外添加选项列表时,它会成功调用onPickListTransfer
,但ui:repeater
内的选项列表不会调用。
我该如何解决这个问题? Primefaces 5.3,Seam 2.3.1
答案 0 :(得分:0)
解决方案是使用<f:param name="skipValidation" value="true"/>
<p:pickList id="orderQuestionPickList#{qStatus.index+1}" styleClass="dutyPickList" responsive="true" showTargetControls="true"
value="#{analysisBean.sampleDualList}" var="option" itemLabel="#{option.text}" itemValue="#{option}" converter="#{itemConverter}" >
<f:facet name="sourceCaption">Tüm Şıklar</f:facet>
<f:facet name="targetCaption">Seçilen Şıklar</f:facet>
<f:param name="skipValidation" value="true"/>
<p:ajax event="transfer" listener="#{analysisBean.onPickListTransfer}" />
</p:pickList>