2012-05-28 66 views
1

我正在使用GF 3.1的PF3.2,JSF 2.0。用於primefaces數據表的自定義過濾器

我有一個數據表,它有一個自定義過濾器。在Firefox中一切正常,但數據表不會在IE中更新。當我點擊頁面中的任何地方時,ajax被觸發,數據表被更新。

這裏是代碼 -

<p:dataTable id="std" 
              value="#{myController.stdList}" 
              selection="#{myController.std}" 
              selectionMode="multiple" 
              var="std" 
              widgetVar="empTable" 
              paginator="true" 
              pageLinks="5" 
              paginatorPosition="bottom" 
              paginatorAlwaysVisible="true" 
              currentPageReportTemplate="Page {currentPage} of {totalPages}" 
              paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" 
              rows="10" 
              rowKey="#{std}" 
              sortBy="#{std.lastName}" 
              sortOrder="ascending" 
              > 
            <p:ajax event="rowSelect" 
              listener="#{myController.onRowSelectListener}" 
              process="@this" 
              update="std" 
              /> 

            <f:facet name="header"> 
             <p:outputPanel> 
              <h:outputText value="#{bundle.GlobalFilterPrompt}" /> 
            <p:inputText id="stdFilter" 
               style="width:150px" 
               valueChangeListener="#{myController.stdListener}"> 
             <p:ajax update="attendees" 
               process="@this" 
               event="change" 
               />      
            </p:inputText> 

stdListener方法從輸入框中的值,獲取新的數據並更新數據表。

爲什麼它在IE中不起作用?

感謝

回答

1

我已經通過調用使用PrimeFaces的DataTable的AJAX/jQuery的過濾器()函數過成功remoteCommand:

<p:inputText id="stdFilter" value="#{myController.myFilterValue}" 
     style="width:150px"> 

<p:ajax event="change" onsuccess="myFilterUpdateCommand();"/> 

<p:remoteCommand id="myRemoteCommandId" name="myFilterUpdateCommand" 
       actionListener="#{myController.stdListener()}" 
       update="attendees" 
       oncomplete="empTable.filter();"/> 

我想你會需要添加一個值到您的inputText組件,以獲取過濾器值到模型/支持bean。