仅在<p:subtable>的第一条记录上调用<f:setpropertyactionlistener> </p:subtable> </f:setpropertyactionlistener>

时间:2014-01-28 07:27:34

标签: jsf primefaces

看一下以下代码:

<p:accordionPanel id="accord" multiple="false" dynamic="true"
    value="#{makelineMB.billNotYetGeneratedOrders}" var="orderList">
    <p:tab title="#{makelineMB.getOrderTypeByList(orderList)}">
        <p:dataTable var="sglOrd" value="#{orderList}">
            <p:columnGroup type="header">
                <p:row>
                    <p:column headerText="Item" />
                    <p:column headerText="Qty" />
                    <p:column headerText="Price" />
                    <p:column headerText="Kitchen Status" />
                </p:row>
            </p:columnGroup>

            <p:subTable var="lineItem" value="#{sglOrd.orderLineItems}">

                <f:facet name="header">
                        #{sglOrd.orderNo} 
                        <p:spacer height="0" width="5" />
                        Total Amt: $#{sglOrd.total}
                        <p:spacer height="0" width="5" />                       
                    <p:commandButton id="cmdBtn_printBill" icon="ui-icon-print"
                        value="Collect Bill"
                        oncomplete="PF('printBill_dlg_widgetVar').show()"
                        update=":dailyorderform:printBill_dlg" style="float:right;">
                        <f:setPropertyActionListener
                            target="#{makelineMB.orderToPrint}" value="#{sglOrd}" />
                    </p:commandButton>
                </f:facet>
                <p:column>
                    <h:outputText value="#{lineItem.menuItemName.toUpperCase()}" />
                </p:
                <p:column>
                    <h:outputText value="#{lineItem.price}" />
                </p:column>
                <p:column>
                    <h:outputText
                        value="#{makelineMB.getOrderLineStatus(lineItem.status)}" />
                </p:column>
            </p:subTable>
        </p:dataTable>
    </p:tab>
</p:accordionPanel>

此代码呈现以下UI:

result of above code

每个标签都包含订单类别,并显示该类别中的订单。每个订单标题都包含<p:commandButton>和关联的<f:setPropertyActionListener>

但是,<f:setPropertyActionListener>只会调用每个标签的第一条记录,其他已提交的订单收取帐单<p:commandButton>不会触发<f:setPropertyActionListener>。这是怎么造成的,我该如何解决?

0 个答案:

没有答案