p:data表选择在没有任何理由的情况下执行



当我点击"创建"按钮时,Primefaces执行控制器.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>

我之所以这样做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>

相关内容

  • 没有找到相关文章

最新更新