Author: ppitonak(a)redhat.com
Date: 2010-10-12 05:30:07 -0400 (Tue, 12 Oct 2010)
New Revision: 19536
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml
Log:
* filtering in rich:dataTable fixed
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java 2010-10-12
01:33:06 UTC (rev 19535)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java 2010-10-12
09:30:07 UTC (rev 19536)
@@ -58,15 +58,15 @@
private int page = 1;
// true = model, false = empty table
private boolean state = true;
-
// sorting
private SortOrder capitalsOrder = SortOrder.unsorted;
private SortOrder statesOrder = SortOrder.unsorted;
-
// filtering
private String sexFilter;
private String nameFilter;
private String titleFilter;
+ private int kidsFilter;
+ private int kidsFilter2;
/**
* Initializes the managed bean.
@@ -179,6 +179,22 @@
this.titleFilter = titleFilter;
}
+ public int getKidsFilter() {
+ return kidsFilter;
+ }
+
+ public void setKidsFilter(int kidsFilter) {
+ this.kidsFilter = kidsFilter;
+ }
+
+ public int getKidsFilter2() {
+ return kidsFilter2;
+ }
+
+ public void setKidsFilter2(int kidsFilter2) {
+ this.kidsFilter2 = kidsFilter2;
+ }
+
public void sortByCapitals() {
statesOrder = SortOrder.unsorted;
if (capitalsOrder.equals(SortOrder.ascending)) {
@@ -196,7 +212,7 @@
setStatesOrder(SortOrder.ascending);
}
}
-
+
public Filter<?> getFilterSexImpl() {
return new Filter<Employee>() {
@@ -210,6 +226,19 @@
};
}
+ public Filter<?> getFilterKidsImpl() {
+ return new Filter<Employee>() {
+
+ public boolean accept(Employee e) {
+ int kids = getKidsFilter();
+ if (e.getNumberOfKids() >= kids) {
+ return true;
+ }
+ return false;
+ }
+ };
+ }
+
public void sortingListener(SortingEvent event) {
System.out.println(event.getSortOrder());
}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml 2010-10-12
01:33:06 UTC (rev 19535)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml 2010-10-12
09:30:07 UTC (rev 19536)
@@ -135,13 +135,15 @@
</f:facet>
</rich:column>
- <rich:column id="columnNumberOfKids">
+ <rich:column id="columnNumberOfKids"
filter="#{richDataTableBean.filterKidsImpl}">
<f:facet name="header">
<h:outputText id="columnHeaderNumberOfKids"
value="Number of Kids" />
<br/>
<h:outputText id="columnHeaderNumberOfKidsType"
value="(expression >=)" />
<br/>
- <h:inputText id="columnHeaderNumberOfKidsInput"
value="TODO inputNumberSpinner"/>
+ <rich:inputNumberSpinner
id="columnHeaderNumberOfKidsInput"
value="#{richDataTableBean.kidsFilter}" minValue="0"
maxValue="5" cycled="true">
+ <a4j:ajax render="commonGrid"
execute="@this"/>
+ </rich:inputNumberSpinner>
</f:facet>
<h:outputText value="#{record.numberOfKids}" />
@@ -156,7 +158,9 @@
<br/>
<h:outputText id="columnHeaderNumberOfKids2Type"
value="(expression <)" />
<br/>
- <h:inputText id="columnHeaderNumberOfKids2Input"
value="TODO inputNumberSlider"/>
+ <rich:inputNumberSlider
id="columnHeaderNumberOfKids2Input"
value="#{richDataTableBean.kidsFilter2}" minValue="0"
maxValue="5" showInput="false">
+ <a4j:ajax render="commonGrid"
execute="@this"/>
+ </rich:inputNumberSlider>
</f:facet>
<h:outputText value="#{record.numberOfKids}" />
Show replies by date