如果单击dataTable 1中的行,如何将行加载到dataTable 2中?

时间:2013-02-14 16:07:24

标签: primefaces datatable

我有一个带有面板和两个dataTable的表单。下面的代码删除了大部分列,以便更容易理解。

<h:form id="invoiceLookUp"> 
<p:panel>                 
    <f:facet name="header">
        <p:column style="font-weight: bold;">
                        Invoice Selection Criteria
                    </p:column>                    
            </f:facet>
            <h:outputText value="Seq ID"/>
            <p:inputText
                id="invoice_header_seq_id" styleClass="field" size="10"
                value="#{invoiceBean.invoice_header_seq_id}"
            />
            <p:commandButton
                update="invoicesTable" value="Look Up"
                action="#{invoiceBean.addInvoices()}"
            />                
</p:panel>
<p:dataTable
    id="invoicesTable" var="invoice" rows="15" lazy="true" selectionMode="single" 
    value="#{invoiceBean.invoiceList}"
    rowKey="#{invoice.invoiceHeader.invoiceHeaderSeqId}"                
    selection="#{invoiceBean.selectedInvoice}"
>
    <p:ajax event="rowSelect" update=":invoiceLookUp:invoiceLinesTable"/>
    <f:facet name="header"><h:outputText value="Invoice Headers" /></f:facet>
    <p:column sortBy="#{invoice.invoiceHeader.invoiceHeaderSeqId}" id="invoiceSeqId">
        <f:facet name="header">
        <h:outputText value="Seq ID" title="Invoice Header Seq ID"/>
        </f:facet>
        <h:outputText value="#{invoice.invoiceHeader.invoiceHeaderSeqId}" />
    </p:column>
</p:dataTable> 
<p:dataTable
    id="invoiceLinesTable" var="invoiceLine" rows="15" lazy="true" selectionMode="single"
    value="#{invoiceBean.selectedInvoice.invoiceLines}"
    rowKey="#{invoiceLine.invoiceLineSeqId}"                
    selection="#{invoiceBean.selectedInvoiceLine}"
        >
    <f:facet name="header"><h:outputText value="Invoice Lines" /></f:facet>
    <p:column sortBy="#{invoiceLine.invoiceLineSeqId}" id="invoiceLineSeqId">  
        <f:facet name="header"><h:outputText value="Line Seq ID"/></f:facet>
        <h:outputText value="#{invoiceLine.invoiceLineSeqId}"/>
    </p:column>
</p:dataTable>
</h:form>

输入Seq ID然后单击“查找”时,表格将按预期填充。当我在invoicesTable中选择一行时,出现以下错误: javax.faces.FacesException:找不到标识符为“:invoiceLookUp:invoiceLinesTable”的组件,该组件引自“form:invoiceLookUp:invoicesTable”。

谁能告诉我我做错了什么?

0 个答案:

没有答案