0

次の要件があります。

ユーザーがページネーターボタンの1つを押して値が含まれている場合は、globalFilter inputTextその値を削除する必要があります。

これはテーブルです(遅延読み込み):

  <p:dataTable id="osTable"
        var="os" 
        value="#{bean.lazyModel}" 
        selection="#{bean.selectedObjectSet}" 
        selectionMode="single"
        rowKey="#{os.ID}"
        paginator="true"
        paginatorPosition="bottom"
        paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
        rowsPerPageTemplate="5,10,15"
        rows="10"
        widgetVar="table">
        <f:facet name="header">  
            <p:outputPanel style="float: right">  
                <h:outputText value="Search all fields:" />  
                <p:inputText id="globalFilter" 
                             value="#{bean.find}" 
                             onkeypress="if (event.keyCode == 13) {table.filter()}" 
                             style="width:150px">

                </p:inputText>
            </p:outputPanel>  
        </f:facet>

私はjavascriptを介してそれを行う必要があると思いますが、この種の機能を実装する方法がわかりません。

4

1 に答える 1

0

これを試して :

<p:ajax event="page" oncomplete="jQuery('#yourFormID\\:yourDataTableID\\:globalFilter').val('')"/>

これにより、ページネーションが完了したときにフィルターがクリーニングされます。

于 2012-08-01T19:06:39.537 に答える