6 Replies Latest reply on Aug 28, 2008 2:10 PM by shadowcreeper

    Datatable Scrollbar with filtermethod not working

    vijaypangam

      I have scrollable datatable, in which i have implemented custom filter using filtermethod in column tag. I can see the scroll bar and able to scroll but I have 2 problems
      1) Custom filter is not working
      2) Sorting is not working
      Everything works fine if i use plain simple Datatable but I need scroll bar for my datatable.
      I am putting both the flavours of my page

      Please can anyone tell me what is going wrong ?

      here's my code using scrollableDataTable :

      <%@ page language="java" contentType="text/html; charset=UTF-8"
       pageEncoding="UTF-8"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
      <f:view>
      <html>
      <head>
      
       <title>Insert title here</title>
       </head>
       <body>
       <h:form>
       <h:panelGroup>
       <h:outputText value="Search"/>
       <h:inputText value="#{filteringBean.filterValue}" id="searchinput">
       <a4j:support event="onkeyup" reRender="table" ignoreDupResponses="true" requestDelay="700" />
       </h:inputText>
       </h:panelGroup>
       <rich:spacer height="20px"/>
       <rich:scrollableDataTable value="#{patientList.patientList}" var="patients" id="table" sortMode="multiple">
       <f:facet name="header">
       <h:outputText value="Patients List"/>
       </f:facet>
       <rich:column id="firstname" filterMethod="#{filteringBean.filterPatients}" >
       <f:facet name="header">
       <h:outputText value="First Name" />
       </f:facet>
       <h:outputText value="#{patients.first_name}"/>
       </rich:column>
       <rich:column id="lastname" >
       <f:facet name="header">
       <h:outputText value="Last Name"/>
       </f:facet>
       <h:outputText value="#{patients.last_name}"/>
       </rich:column>
       <rich:column id="dob" >
       <f:facet name="header">
       <h:outputText value="DOB"/>
       </f:facet>
       <h:outputText value="#{patients.date_of_birth}">
       <f:convertDateTime pattern="MM/dd/yyyy" />
       </h:outputText>
       </rich:column>
       </rich:scrollableDataTable>
       </h:form>
      </body>
      </html>
      </f:view>

      here's code with simple richfaces datatable

      <%@ page language="java" contentType="text/html; charset=UTF-8"
       pageEncoding="UTF-8"%>
      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
      <f:view>
      <html>
      <head>
      
       <title>Insert title here</title>
      <script language ="javascript">
      function func()
      {
       var input = document.getElementById("patientForm:table:searchinput");
       input.focus();
       input.value=input.value;
      }
      </script>
      </head>
      <body>
      <h:form id="patientForm">
      
      <h:panelGroup>
       <h:outputText value="Search"/>
      
      
      
       <h:inputText value="#{filteringBean.filterValue}" id="searchinput">
       <a4j:support event="onkeyup" reRender="table" ignoreDupResponses="true" requestDelay="700" oncomplete="func();" />
       </h:inputText>
      
      
      </h:panelGroup>
       <rich:spacer height="20px"/>
      
      <rich:dataTable value="#{patientList.patientList}" width="700px" var="patients" id="table" sortMode="single" >
      
      
       <f:facet name="caption"><h:outputText value="Patients List" /></f:facet>
       <f:facet name="header">
       <h:outputText value="Patient Data" />
       </f:facet>
      
       <rich:column filterMethod="#{filteringBean.filterPatients}" sortBy="#{patients.first_name}" >
       <f:facet name="header">
       <h:outputText value="First Name" />
       </f:facet>
       <h:outputText value="#{patients.first_name}"/>
       </rich:column>
       <rich:column sortBy="#{patients.last_name}">
       <f:facet name="header">
       <h:outputText value="Last Name"/>
       </f:facet>
      
       <h:outputText value="#{patients.last_name}"/>
      
       </rich:column>
       <rich:column sortBy="#{patients.date_of_birth}" >
       <f:facet name="header">
       <h:outputText value="DOB"/>
       </f:facet>
       <h:outputText value="#{patients.date_of_birth}">
       <f:convertDateTime pattern="MM/dd/yyyy" />
       </h:outputText>
      
       </rich:column>
      
      
       </rich:dataTable>
      
      </h:form>
      
      </body>
      </html>
      </f:view>