0

私のアプリケーションでは、<p:dataTable>遅延データモデルを使用したページネーションがあります。

ページから別のページ ボタンをクリックすると、確認ポップアップが生成される必要があります。クリックyesすると別のページに移動でき、[いいえ] をクリックすると別のページに移動できず、そのまま残ります。その現在のページで。

.xhtml コードを以下に示します。

<h:form id="userListForm">
    <p:dataTable var="user" id="userTable" value="#{userListController.userDataModel}" lazy="true" paginator="true" rows="25" paginatorPosition="bottom"
            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
            rowsPerPageTemplate="25,50,100" widgetVar="userDataTable" styleClass="userTable" selectionMode="single" >
       <p:ajax event="page" />

       <p:column id="nameColumn" headerText="#{adbBundle['name']}"
           sortBy="#{user.fullName}" filterBy="#{user.fullName}" styleClass="userName">
           <h:outputText value="#{user.fullName}" />
       </p:column>

       <!-- other columns -->

    <:/p:dataTable>
</h:form>

私はprimefaces 3.4、jsf 2.0を使用しています。

4

2 に答える 2

1

RongNK の回答に触発されて、単純にこれを行うことができます。

このスクリプト ブロックを追加します。

<script type="text/javascript">
    function onPageStart() {
        return confirm('Are you sure?');
    }
</script>

これをデータテーブルに入れます:

<p:ajax event="page" onstart="return onPageStart()" />

次のようにインライン化することもできます<p:ajax

<p:ajax event="page" onstart="return confirm('Are you sure?');" />

PrimeFaces 3.4.2 でテスト済みおよび動作中

于 2013-04-05T06:57:44.420 に答える