p:dataTable选择无任何原因执行

时间:2016-07-11 18:32:52

标签: jsf primefaces

当我点击"创建"按钮Primefaces执行controller.selectedTableItem方法,为什么?我甚至没有更新数据表?

<p:panel header="#{title}">
            <p:toolbar>
                <f:facet name="left">

                    <p:commandButton id="createButton" icon="ui-icon-plus"
                        value="#{localization.Create}" ajax="true"


                        update=":ShipmentFormDiv editButton viewButton">

                        <p:confirm header="#{localization.ConfirmationHeader}"
                            message="#{localization.ConfirmCreateMessage}"
                            icon="ui-icon-alert" />
                    </p:commandButton>  
              </f:facet>

         </p:toolbar>   

         <p:dataTable id="datalist" widgetVar="datalist"
                value="#{controller.lazyItems}" lazy="true" var="item"
                paginator="true" rows="10" rowsPerPageTemplate="10,20,30,40,50"
                selectionMode="single" selection="#{controller.selectedTableItem}"
                paginatorPosition="bottom" reflow="true"
                rowStyleClass="#{item.rowStyleClass}">

                <p:ajax event="rowSelect"
                    update="@form:createButton,@form:viewButton,@form:editButton,@form:deleteButton,@form:InboundShipmentDataTableContextMenu,:ShipmentFormDiv, @form:timeline"
                    listener="#{controller.onSelect}" />

                <p:ajax event="rowUnselect"
                    update="@form:createButton,@form:viewButton,@form:editButton,@form:deleteButton,@form:InboundShipmentDataTableContextMenu, :ShipmentFormDiv"
                    listener="#{controller.onUnselect}" />

                <p:ajax event="contextMenu"
                    update="@form:createButton @form:viewButton @form:editButton @form:deleteButton"
                    listener="#{controller.onContextMenu}" />

                <p:ajax event="rowDblselect"
                    onsuccess="document.getElementById('ShipmentListForm:viewButton').click();" />


                <ui:include src="/admin/templates/columns/office.xhtml">
                </ui:include>


            </p:dataTable>
 </p:panel>

1 个答案:

答案 0 :(得分:0)

我认为这是因为p:commandButton处理祖先形式的每个组件。似乎process="@none"有帮助。

            <p:commandButton id="createButton" icon="ui-icon-plus"
                value="#{localization.Create}"
                actionListener="#{controller.prepareCreate}"
                update=":ShipmentFormDiv,:ShipmentListForm, editButton, viewButton"
                process="@none">

                <p:confirm header="#{localization.ConfirmationHeader}"
                    message="#{localization.ConfirmCreateMessage}"
                    icon="ui-icon-alert" />
            </p:commandButton>