最初我使用了一个可编辑的dataTable,它工作正常。 然后我将dataTable放在一个动态的tabView选项卡中,然后在第一个渲染的选项卡中工作正常,但在我更改选项卡后,我无法编辑单元格。 PrimeFaces版本:6.0
<p:tabView value="#{tippingViewBean.rounds}" var="round" dynamic="true">
<p:tab title="#{round}.">
<p:dataTable id="tippingTable#{round}" rowIndexVar="rowId" editable="true" editMode="cell"
widgetVar="cellTips"
var="userTip" value="#{tippingViewBean.getUserTips(round)}"
resizableColumns="true">
<p:ajax event="cellEdit" listener="#{tippingViewBean.addTip(userTip)}"/>
<p:column headerText="Kezdés">
<h:outputText value="#{userTip.schedule.date}"/>
</p:column>
<p:column headerText="Hazai Csapat">
<h:outputText value="#{userTip.schedule.homeTeam.name}"/>
</p:column>
<p:column headerText="Vendég Cspat">
<h:outputText value="#{userTip.schedule.awayTeam.name}"/>
</p:column>
<p:column headerText="Győztes">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{userTip.winnerTip}"/></f:facet>
<f:facet name="input">
<p:selectOneMenu id="winnerTipInput#{round}"
disabled="#{tippingViewBean.tipIsClosed(userTip)}"
value="#{tippingViewBean.winnerTip}" style="width: 100%">
<f:selectItems value="#{tippingViewBean.winnerTipForSelection}" var="selectItem"
itemLabel="#{selectItem}" itemValue="#{selectItem}"/>
</p:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="2,5 Gól alatt/felett">
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{userTip.twoAndHalfTip}"/></f:facet>
<f:facet name="input">
<p:selectOneMenu id="goalsTipInput#{round}"
disabled="#{tippingViewBean.tipIsClosed(userTip)}"
value="#{tippingViewBean.goalsTip}" style="width: 100%">
<f:selectItems value="#{tippingViewBean.goalsTipForSelection}" var="goalsSelectItem"
itemLabel="#{goalsSelectItem}" itemValue="#{goalsSelectItem}"/>
</p:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
</p:tab>
</p:tabView>
我做错了什么?
答案 0 :(得分:0)
好的,我找到了答案。 我将dataTable的widgetVar更改为unique(cellTips#{round}),并且它可以正常工作。