Primefaces提交功能和oncomplete不适用于p:向导

时间:2013-10-28 07:40:58

标签: java primefaces

点击向导组件中的提交按钮后,无法调用支持bean中的相关功能。

然后我尝试将属性“process”放在Submit按钮上并且它可以工作。但是,在辅助bean中的函数完成后,不会调用oncomplete函数。

任何人都可以提供帮助???

<f:view xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:p="http://primefaces.org/ui"
xmlns:ngbf="http://ngbf.kingstar.com">


<ui:composition template="/xhtml/views/index-template.xhtml"> 
    <ui:define name="frame-main">
        <script language="JavaScript" type="text/javascript">
            $(document).ready(function(){
            });
        </script>
        <style>
            .columnClazz{
                vertical-align: top;
            }
            .rowClazz{
                vertical-align: top;
            }
        </style>
        <h:form id="form">
        <p:wizard flowListener="#{saleOrderGenerationViewModel.onFlowProcess}" id="saleWizardId" nextLabel="下一步" backLabel="上一步" widgetVar="saleWizard">
        <!--    <p:tabView id="tabView"> -->  
            <p:tab id="personalInfo" title="客户信息">
                <br/>
                <p:fieldset legend="账号信息">  
                    <h:panelGrid columns="2">
                        <h:outputText value="银行账号 :"/> 
                        <p:inputText value="#{saleOrderGenerationViewModel.custInfo.bank_acc}" id="bankAcc">
                            <p:ajax event="blur" listener="#{saleOrderGenerationViewModel.retrieveCustInfoByAcc}" update=":form:saleWizardId"/>
                        </p:inputText>
                    </h:panelGrid>  
                </p:fieldset>
                <br/>  
                <p:fieldset legend="基本信息">  
                    <h:panelGrid columns="2">
                        <h:outputText value="客户姓名:"/>
                        <p:inputText value="#{saleOrderGenerationViewModel.custInfo.cust_name}"/>
                        <h:outputText value="证件类型:"/>
                        <p:selectOneMenu value="#{saleOrderGenerationViewModel.custInfo.cert_type}">
                            <ngbf:dictItems name="19" space="true" showValue="false"
                                reposType="0" /> 
                        </p:selectOneMenu>
                        <h:outputText value="证件号码:"/>
                        <p:inputText value="#{saleOrderGenerationViewModel.custInfo.cert_no}"/>
                    </h:panelGrid>  
                </p:fieldset> 
                <br/>
                <p:fieldset legend="联系方式">  
                    <h:panelGrid columns="4">
                        <h:outputText value="电话:"/>
                        <p:inputText value="#{saleOrderGenerationViewModel.custInfo.phone}"/>
                        <h:outputText value="手机:"/>
                        <p:inputText value="#{saleOrderGenerationViewModel.custInfo.tel}"/>
                        <h:outputText value="邮箱:"/>
                        <p:inputText value="#{saleOrderGenerationViewModel.custInfo.email}"/>
                        <h:outputText value="地址:"/>
                        <p:inputText value="#{saleOrderGenerationViewModel.custInfo.address}"/>
                        <h:outputText value="邮编:"/>
                        <p:inputText value="#{saleOrderGenerationViewModel.custInfo.post_code}"/>
                    </h:panelGrid>  
                </p:fieldset>  
            </p:tab> 
            <p:tab id="saleInfo" title="销售信息">
            <h:panelGrid id="pricePanel" columns="2" style="width:100%;" columnClasses="columnClazz" rowClasses="rowClazz">
                <h:panelGrid columns="1" style="width:400px;text-align:left;border-style:solid;border-color:#d3d3d3;">
                    <p:dataTable scrollHeight="250"  id="priceData" var="item" value="#{saleOrderGenerationViewModel.quoteInfo}" 
                    scrollable="true" rowIndexVar="rowInfo" rowKey="#{item.brand_code}" selection="#{saleOrderGenerationViewModel.selectedBrand}" selectionMode="single">
                        <p:ajax event="rowSelect" listener="#{saleOrderGenerationViewModel.onRowSelect}"
                                update=":form:saleDetailData"/>     
                        <p:columnGroup id="columnGroup" type="header">
                            <p:row>
                                <p:column id="goldHeader" rendered="true" headerText="实物金" colspan="4"/>
                            </p:row>
                             <p:row>
                                <p:column id="brandHeader" rendered="true" headerText="品牌"/>
                                <p:column id="quoteDateHeader" rendered="true" headerText="报价日期"/>
                                <p:column id="salePriceHeader" rendered="true" headerText="卖出价"/>
                                <p:column id="redeemPriceHeader" rendered="true" headerText="赎回价"/>
                            </p:row>
                        </p:columnGroup>
                        <p:column id="brand_code" rendered="true">
                            #{saleOrderGenerationViewModel.brandMap[item.brand_code]}
                        </p:column>
                        <p:column id="quote_date" rendered="true">
                            #{item.quote_date} 
                        </p:column>
                        <p:column id="salePrice" rendered="true">
                           #{item.entity_sale_price}
                        </p:column>.
                        <p:column id="redeemPrice" rendered="true">
                            #{item.entity_redeem_price}
                        </p:column>
                    </p:dataTable>
                </h:panelGrid>
                <h:panelGrid columns="1" style="text-align:left;border-style:solid;border-color:#d3d3d3;">
                    <p:dataTable   id="saleDetailData" var="item" value="#{saleOrderGenerationViewModel.saleOrders}" 
                    scrollable="true">
                        <p:ajax event="rowSelect" actionListener="saleOrderGenerationViewModel.onRowSelected"/>
                        <p:columnGroup id="detailColumnGroup" type="header">
                            <p:row>
                                <p:column id="saleDetailHeader" rendered="true" headerText="销售明细" colspan="6"/>
                            </p:row>
                             <p:row>
                                <p:column id="detailOper" rendered="true" headerText="操作"/>
                                <p:column id="detailBrand" rendered="true" headerText="品牌"/>
                                <p:column id="detailSpec" rendered="true" headerText="规格"/>
                                <p:column id="detailBranchAvail" rendered="true" headerText="网点可用库存"/>
                                <p:column id="detailDepotAvail" rendered="true" headerText="可用库存"/>
                                <p:column id="detailAmount" rendered="true" headerText="数量"/>
                            </p:row>
                        </p:columnGroup>
                        <p:column id="operate">
                            <p:commandLink
                                actionListener="#{saleOrderGenerationViewModel.deleteSaleOrder}" value="删除" process="@this" update=":form:saleDetailData">
                                <f:attribute name="item" value="#{item}"/>
                            </p:commandLink>
                        </p:column>
                        <p:column id="brand_code" rendered="true">
                            #{saleOrderGenerationViewModel.brandMap[item.brandCode]}
                        </p:column>
                        <p:column id="brand_spec" rendered="true">
                            <p:selectOneMenu value="#{item.spec}" id="brandSpec">
                                    <f:attribute name="item" value="#{item}"/>
                                    <f:selectItem itemLabel="请选择规格" itemValue="" />
                                    <f:selectItems value="#{item.brandSpecs}" var="b"
                                    itemLabel="#{b.spec}" itemValue="#{b.spec}"/>
                                    <p:ajax update=":form:saleDetailData" event="valueChange" listener="#{saleOrderGenerationViewModel.fetchStockByBrandSpec}">
                                    </p:ajax>
                            </p:selectOneMenu>
                             <!--<p:cellEditor>  
                                <f:facet name="output"><h:outputText value="#{item.spec}" /></f:facet>  
                                <f:facet name="input">  
                                    <h:selectOneMenu value="#{item.spec}" style="width:100%">  
                                        <f:selectItems value="#{item.brandSpecs}" var="s" itemLabel="#{s.spec}" itemValue="#{s.spec}" />  
                                    </h:selectOneMenu>  
                                </f:facet>  
                            </p:cellEditor> 
                             <p:autoComplete value="#{item.spec}"
                                id="brandSpecPojo"
                                completeMethod="#{brandSpecAutoComplete.autoComplete}" var="p"
                                itemLabel="#{p.spec}" itemValue="#{p.spec}"
                                forceSelection="true" dropdown="true"
                                queryDelay="100"  scrollHeight="300">
                                <p:ajax event="focus" listener="#{saleOrderGenerationViewModel.handleFocus}"/>
                            </p:autoComplete>
                              -->
                        </p:column> 
                         <p:column id="branch_avail" rendered="true">
                            #{item.branchAvail}
                        </p:column>
                         <p:column id="depot_avail" rendered="true">
                            #{item.depotAvail}
                        </p:column>
                        <p:column id="amount">
                            <p:inputText value=" #{item.quantity}">
                                <p:ajax update=":form:saleDetailData" event="valueChange" />
                            </p:inputText>
                        </p:column>

                    </p:dataTable>
                    <p:commandButton value="提交" id="saleBut" style="float:right"
                        actionListener="#{saleOrderGenerationViewModel.doPurchaseEvent}" oncomplete="alert('aaa');" validator="#{validator.brand_spec}"
                        update=":form:returnDlg"/>
                </h:panelGrid>
            </h:panelGrid>
            <!-- <p:contextMenu for=":form:saleDetailData">  
                <p:menuitem id="delMenu" value="Delete" update=":form:saleDetailData" icon="ui-icon-close" actionListener="#{saleOrderGenerationViewModel.deleteSaleOrder}"/>
            </p:contextMenu> -->
            </p:tab>    
            <p:tab id="returnInfo" title="返回信息">
            </p:tab>
            <!--</p:tabView>-->
             </p:wizard>
             <p:confirmDialog id="delconfirmDialog" widgetVar="delConfirmation"
                    message="确定删除吗?" header="确认" 
                    closable="true" position="center">
                        <h:panelGrid columns="2">
                            <p:commandButton id="delConfirm" value="确定"
                                onclick="delConfirmation.hide()" update=":infoDialog:dialog"
                                actionListener="#{saleOrderGenerationViewModel.deleteSaleOrder}">
                            </p:commandButton>
                            <p:commandButton id="delDecline" value="取消"
                                onclick="delConfirmation.hide()" />
                        </h:panelGrid>
            </p:confirmDialog>
            <p:dialog id="returnDlg" widgetVar="returnDlg" header="处理结果" 
                      closable="true" resizable="true" position="center">
            </p:dialog>
        </h:form>
        <p:confirmDialog id="submitConfirmDialog" widgetVar="submitConfirmation"
                    message="确定提交吗?" header="确认" 
                    closable="true" position="center">
                        <h:panelGrid columns="2">
                            <p:commandButton id="submitConfirm" value="确定"
                                onclick="submitConfirmation.hide()" update=":infoDialog:dialog"
                                actionListener="#{saleOrderGenerationViewModel.doPurchaseEvent}" oncomplete="saleWizard.next()">
                            </p:commandButton>
                            <p:commandButton id="submitDecline" value="取消"
                                onclick="submitConfirmation.hide()" />
                        </h:panelGrid>
            </p:confirmDialog>


    </ui:define>
</ui:composition>

0 个答案:

没有答案