4 Replies Latest reply on Apr 1, 2008 9:36 AM by Konstantin Mishin

    RF200 Filtering DataTable throws NPE

    Carsten Hoehne Master

      Hello,
      2 observations for the new filtering feature in datatable.

      This is what i have done:
      With RF3.1.4 i have implemented the filtering by myself.
      The page (augmented by the new Attributs filterBy and filterEvent):

      <h:form>
       <h:outputText value="Filter by RequestDate" />
       <h:inputText value="#{transactionBacking.date}">
       <a4j:support action="#{transactionBacking.filter}" event="onkeyup"
       reRender="transactionList"></a4j:support>
       </h:inputText>
      
       <rich:spacer width="20" />
      
       <h:outputText value="Filter by Institut" />
       <h:inputText value="#{transactionBacking.institut}">
       <a4j:support action="#{transactionBacking.filter}" event="onkeyup"
       reRender="transactionList"></a4j:support>
       </h:inputText>
      
       <rich:dataTable id="transactionList" var="seedtransaction"
       value="#{transactionBacking.senderList}" width="80%"
       rendered="#{not empty transactionBacking.senderList}" >
       <f:facet name="header">Transactions</f:facet>
       <rich:column filterEvent="onkeyup" filterBy="#{seedtransaction.transaction.requestDate}">
       <f:facet name="header">RequestDate</f:facet>
       <h:outputText value="#{seedtransaction.transaction.requestDate}" />
       </rich:column>
       <rich:column filterEvent="onkeyup" filterBy="#{seedtransaction.address.faocode}">
       <f:facet name="header">FAO code</f:facet>
       <h:outputText value="#{seedtransaction.address.faocode}" />
       </rich:column>
       <rich:column filterEvent="onkeyup" filterBy="#{seedtransaction.address.institution}">
       <f:facet name="header">Institut</f:facet>
       <h:outputText value="#{seedtransaction.address.institution}" />
       </rich:column>
       <rich:column filterEvent="onkeyup" filterBy="#{seedtransaction.address.place}">
       <f:facet name="header">location</f:facet>
       <h:outputText value="#{seedtransaction.address.place}" />
       </rich:column>
       <rich:column filterEvent="onkeyup" filterBy="#{seedtransaction.address.countrycode}">
       <f:facet name="header">Country</f:facet>
       <h:outputText value="#{seedtransaction.address.countrycode}" />
       </rich:column>
       <rich:column>
      
       <s:button value="select"
       </s:button>
       </rich:column>
       </rich:dataTable>
      
       </h:form>


      Filtering by my method works. Eg filling in some data into the input fields above the table.
      1. Observation
      Using the filter controls of the columns leads to an NPE:-(
      This is because some of my data has null values for specific columns.
      When omitting the columns with null values for filtering, then filtering works.

      FR: It should be possible to filter columns with null values.
      Workaround: For now i will try filtermethod together with filterValue.

      2.Observation
      The filtering tests if the data begins with the filter value. I have not found this restriction in the documentation. If it is really not there, please document it.
      I do need to filter by instring so i am using 'String.contains' to test.
      FR: It would be nice if this get configurable (contains/startswith)

      Conclusion
      A nice, really needed feature. Thanks for implementing it.



      This is the NPE i got.
      11:47:42,796 ERROR [STDERR] 01.04.2008 11:47:42 com.sun.facelets.FaceletViewHandler handleRenderException
      SCHWERWIEGEND: Error Rendering View[/seedtransfer/TransactionList.xhtml]
      java.lang.NullPointerException
       at org.richfaces.model.impl.expressive.WrappedBeanFilter.accept(WrappedBeanFilter.java:30)
       at org.richfaces.model.ModifiableModel.prepareCollection(ModifiableModel.java:165)
       at org.richfaces.model.ModifiableModel.walk(ModifiableModel.java:111)
       at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:1112)
       at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:106)
       at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:91)
       at org.richfaces.renderkit.AbstractRowsRenderer.encodeChildren(AbstractRowsRenderer.java:138)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:125)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:68)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:116)
       at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:123)
       at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:641)
       at org.ajax4jsf.component.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:512)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
       at org.ajax4jsf.Filter.doFilter(Filter.java:175)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:595)