2 Replies Latest reply on Mar 27, 2013 4:59 AM by Thomas Falkenberg

    datatable not shows input filter box

    Keith Wong Newbie

      Try to use default filter on datatable in RF4.2.2-final jars. No input filter box showed.

      Thanks in advance.

       

      snipplet of xhtml:

          <h:form>

                          <rich:dataTable value="#{userBeanView.users}" var="cap" width="200px" id="ttt">

                                  <f:facet name="header">

                                      <h:outputText value="Sorting Example"/>

                                  </f:facet>

                                  <rich:column filterBy="#{cap.userName}" filterEvent="onkeyup">

                                          <f:facet name="header">

                                              <h:outputText value="User Name"/>

                                          </f:facet>

                                         <h:outputText value="#{cap.userName}"/>

                                  </rich:column>

       

                                  <rich:column filterBy="#{cap.emailAddr}" filterEvent="onkeyup">

                                      <f:facet name="header">

                                          <h:outputText value="Email Address"/>

                                      </f:facet>

                                      <h:outputText value="#{cap.emailAddr}"/>

                                  </rich:column>

                          </rich:dataTable>   

          </h:form>

       

      snipplet of viewscope backed bean:

      public List<User> getUsers() {

        //users = accountService.getAllUsers();

        users = new ArrayList();

        for (int i =1;i < 11; i++){

         User user = new User();

         user.setUserName("test0"+i);

         user.setCellNum("543987698"+i);

         user.setEmailAddr("email"+i+"@email.com");

         users.add(user);

        }

        logger.info("Got size of user:"+users.size());

        return users;

      }

       

      dt.JPG

        • 1. Re: datatable not shows input filter box
          kevin 2 Newbie

          You should add <h:inputText/> in the header facet of your columns as it is done in the showcase example :

           

           

          <rich:column filterValue="#{carsFilteringBean.vinFilter}"
              filterExpression="#{fn:containsIgnoreCase(car.vin,carsFilteringBean.vinFilter)}">
              <f:facet name="header">
                  <h:panelGroup>
                      <h:outputText value="VIN " />
                      <h:inputText value="#{carsFilteringBean.vinFilter}">
                          <a4j:ajax event="blur" render="table" execute="@this" />
                      </h:inputText>
                  </h:panelGroup>
              </f:facet>
              <h:outputText value="#{car.vin}" />
          </rich:column>
          
          
          • 2. Re: datatable not shows input filter box
            Thomas Falkenberg Newbie

            Hi

            i've got the same Problem when trying to use build-in search.

             

            @kevin this solution works fine but it doesn't use the filterBy and filterEvent attributes, which would make the code more readable.

             

            Is it possible to use these attributes?

             

            Thanks