2013-02-22 133 views
1

我不確定我的HTML代碼有什麼問題。從我讀的,它應該工作。我甚至嘗試使用prependId="false"這不能解決找不到UI組件的問題。Primefaces從另一個表格內更新

<p:tabView> 
     <p:tab title="Tab1" id="tab1"> 
      <h:form id="form1" prependId="false"> 
       <p:panelGrid columns="2" id="grid1"> 

        <h:outputLabel for="minDraw" value="Starting draw number:" /> 
        <p:inputText id="minDraw" value="#{LottoMaxBacking.minDraw}" /> 
        <p:commandButton value="Get Frequency From Begining" 
         actionListener="#{LottoMaxBacking.loadAllDrawFreq}" 
         update=":form2:freqTable" /> 
       </p:panelGrid> 
      </h:form> 
      <h:form id="form2" prependId="false"> 
       <p:dataTable var="entry" value="#{LottoMaxBacking.drawFreqList}" 
        id="freqTable"> 
        <f:facet name="header"> 
         <h:outputText value="#{LottoMaxBacking.tableHeader}" /> 
        </f:facet> 
        <p:column sortBy="#{entry.key}" headerText="Ball Number"> 

         <h:outputText value="#{entry.key}" /> 

        </p:column> 
        <p:column sortBy="#{entry.value}" headerText="Frequency"> 

         <h:outputText value="#{entry.value}" /> 

        </p:column> 

       </p:dataTable> 
      </h:form> 
     </p:tab> 
     <p:tab title="Tab 2"></p:tab> 
    </p:tabView> 

我試過":tab1:form2:freqTable"":freqTable",並且"freqTable"但他們沒有工作。當我將這兩個表單合併爲一個表單時,它會發現freqTable很好。

+1

查看呈現頁面時的HTML源代碼,並查看將哪個ID分配給'dataTable',這是最容易的。 – partlov 2013-02-22 08:55:57

回答

1

好的,我終於看到了錯誤消息後再次發現它。

找不到標識符組件 「:窗口2:freqTable」 從引用的 「j_idt54:j_idt56」

idt54指TabView的和idt56指命令按鈕。所以事實證明,我的按鈕的AJAX更新字符串沒有足夠的原始和我所有其他嘗試引用了錯誤的父容器。我在p:tabView中添加了一個id,並更改了更新字符串,它工作。

<p:commandButton value="Get Frequency From Begining" 
    actionListener="#{LottoMaxBacking.loadAllDrawFreq}" 
    update="tv:form2:freqTable" />