简体   繁体   English

PrimeFaces如何取消filterBy组件上的事件监听

[英]PrimeFaces how to cancel event listener on filterBy component

I'm using PrimeFaces dataTable with filterBy on a column.我在列上使用带有 filterBy 的 PrimeFaces 数据表。 I also have a link that when clicked, empty out the underlying table.我还有一个链接,单击该链接会清空基础表。 Everything works fine until I filter on something.一切正常,直到我过滤某些东西。 If I then clear the underlying table, the table is still displayed from cache and it won't get update to an empty table until I change the filterBy value.如果我随后清除基础表,该表仍会从缓存中显示,并且在我更改 filterBy 值之前它不会更新为空表。 It seems the filterBy input component is still holding on to the event listener.似乎 filterBy 输入组件仍在保留事件侦听器。 Here's my code snipet:这是我的代码片段:

<h:form id="logFormId" prependId="false">
  <p:dataTable value="#{logger.logLines}" var="logMsg"
  id="loggerTable" dynamic="false" widgetVar="logTable">
    <f:facet name="header">
      <h:commandLink action="#{logger.clearList}">
    <f:ajax render="@form" execute="@form" />
  </h:commandLink>
    </f:facet>
    <p:column>
  <f:facet name="header">
    <h:outputText value="#{msgs.LoggerDate}" />
  </f:facet>
  <h:outputText value="#{logMsg.dateText}" />
</p:column>
<p:column sortBy="#{logMsg.source}" 
    filterBy="#{logMsg.source}" filterMatchMode="contains" >
  <f:facet name="header">
    <h:outputText value="#{msgs.LoggerSource}  " />
  </f:facet>
  <h:outputText value="#{logMsg.source}" />
</p:column>
  </p:dataTable>
</h:form>

I am not sure I know the answer but here are some things to try.我不确定我是否知道答案,但这里有一些可以尝试的方法。 I assume this is primefaces 2.2.我假设这是 primefaces 2.2。

  1. I don't think the dynamic attribute is used anymore in p:datatable .我认为p:datatable不再使用动态属性。

  2. In your f:ajax element, try render="loggerTable" instead of @form .在您的f:ajax元素中,尝试使用 render="loggerTable"而不是@form

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM