2 Replies Latest reply on Sep 5, 2011 2:58 PM by sweetpea

    rich:extendedDataTable filter (richfaces 4.0.0) not working

    sweetpea Newbie

      Hi, I cannot get filtering to work at all.

      My bean:

      {code}package com.nokia.DWH.dao;

       

      import java.util.ArrayList;

       

      import javax.faces.bean.*;

      import javax.faces.bean.ManagedBean;

      @ManagedBean(name="TestDao", eager=true)

      @RequestScoped

      public class TestDao {

                String name;

       

                public String getName() {

                          return name;

                }

       

                public void setName(String name) {

                          this.name = name;

                }

       

                public TestDao(String name) {

                          this.name=name;

                }

       

                public TestDao() { 

                }

       

                public ArrayList<TestDao> listTestDaos() {

                          ArrayList<TestDao> l = new ArrayList<TestDao>();

                          for(int i = 0;i < 40;i++) {

                                    l.add(new TestDao(i + "bean"));

                          }

                          return l;

                }

      }{code}

       

      my xhtml-page test.xhtml:

       

      {code:xml}<?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

                xmlns:f="http://java.sun.com/jsf/core"

                xmlns:h="http://java.sun.com/jsf/html"

                xmlns:a4j="http://richfaces.org/a4j"

                xmlns:rich="http://richfaces.org/rich">

      <h:head>

                <title>JSF 2.0 test page</title>

      </h:head>

      <h:body>

                <h3> JSF 2/table demo</h3>

                <h:form>

                <rich:dataTable value="#{TestDao.listTestDaos()}" var="o"

                                    selectionMode="multiple" style="width:200px;height:100px;">

                                    <rich:column width="200px" filterBy="#{o.name}" filterEvent="onkeyup">

                                              <f:facet name="header">

                                                        <h:outputText value="name" />

                                                        <h:inputText value="#{o.name}"/>

                                              </f:facet>

                                              <h:outputText value="#{o.name}" />

                                    </rich:column>

                          </rich:dataTable>

                </h:form>

                </h:body>

      </html>{code}

       

      Table is rendered beautifully.

       

      BUT: All the examples I have seen say that filtering can be enabled easily by just adding filterBy and filterEvent to rich:column.

       

      Well, doing that does nothing at all, no input is rendered.So I added input-field, but still nothing is happening. I checked out a lot of examples from the documentation but I seem to be missing something simple.