2017-09-05 94 views
0

最初我使用了一个可编辑的数据表,它工作正常。 然后我把dataTable放在dymanic tabView的选项卡中,然后在第一个渲染选项卡中工作正常,但是在更改选项卡后,我无法编辑单元格。 PrimeFaces版本:6.0Primefaces dataTable无法在标签更改后编辑

<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

好吧,我找到了答案。 我将dataTable的widgetVar更改为唯一(cellTips#{round}),并且它可以工作。