Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Richfaces Scrollable Datatable with filtermethod not working

 
amitraj bharat
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :
Code:

<%@ 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>
<hutputText 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">
<hutputText value="Patients List"/>
</f:facet>
<rich:column id="firstname" filterMethod="#{filteringBean.filterPatients}" >
<f:facet name="header">
<hutputText value="First Name" />
</f:facet>
<hutputText value="#{patients.first_name}"/>
</rich:column>
<rich:column id="lastname" >
<f:facet name="header">
<hutputText value="Last Name"/>
</f:facet>
<hutputText value="#{patients.last_name}"/>
</rich:column>
<rich:column id="dob" >
<f:facet name="header">
<hutputText value="DOB"/>
</f:facet>
<hutputText value="#{patients.date_of_birth}">
<f:convertDateTime pattern="MM/dd/yyyy" />
</hutputText>
</rich:column>
</rich:scrollableDataTable>
</h:form>
</body>
</html>
</f:view>

here's code with simple richfaces datatable

Code:
<%@ 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>
<hutputText 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"><hutputText value="Patients List" /></f:facet>
<f:facet name="header">
<hutputText value="Patient Data" />
</f:facet>

<rich:column filterMethod="#{filteringBean.filterPatients}" sortBy="#{patients.first_name}" >
<f:facet name="header">
<hutputText value="First Name" />
</f:facet>
<hutputText value="#{patients.first_name}"/>
</rich:column>
<rich:column sortBy="#{patients.last_name}">
<f:facet name="header">
<hutputText value="Last Name"/>
</f:facet>

<hutputText value="#{patients.last_name}"/>

</rich:column>
<rich:column sortBy="#{patients.date_of_birth}" >
<f:facet name="header">
<hutputText value="DOB"/>
</f:facet>
<hutputText value="#{patients.date_of_birth}">
<f:convertDateTime pattern="MM/dd/yyyy" />
</hutputText>

</rich:column>


</rich:dataTable>

</h:form>

</body>
</html>
</f:view>
[ August 27, 2008: Message edited by: amitraj bharat ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic