Is there any way to apply a filter which is range of date?
Suppose i want to display only those rows which has a manufacturing date between Jan 1, 2010 to Jan 15, 2010.
Date Range Filter in Data Table
-
- Posts: 17
- Joined: 02 Sep 2010, 17:27
I have the same issue too
primefaces 3.3.1, mojarra 2.1.7, tomcat 7.0.27, java sun 1.6.0_24, netbeans 7.1.1
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
No but you can implement your own filtering by placing input yourself on column header.
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Filtering enhancements are pending, stay tuned.
Optimus,
do you have an example i can see of this:
Chris
do you have an example i can see of this:
Thanks,No but you can implement your own filtering by placing input yourself on column header.
Chris
- Chris
PrimeFaces 3.0M1
Eclipse Indigo (with Tomcat 7.0.14)
Java 1.6
JSF 2.0 (Mojarra 2.0.4)
hibernate 3.5.5
PrimeFaces 3.0M1
Eclipse Indigo (with Tomcat 7.0.14)
Java 1.6
JSF 2.0 (Mojarra 2.0.4)
hibernate 3.5.5
Any update on date range filtering for DataTable ?
I've been able to put in a "filterBy" and both the textbox and dropdown approach let me key on a specific date, although both seem like a bit of a kludgy way to select a date.
What I'd really like to do is have the filter give a nice date selector, and/or a date range selector (similar to what you typically have on airline search sites for example).
I've been able to put in a "filterBy" and both the textbox and dropdown approach let me key on a specific date, although both seem like a bit of a kludgy way to select a date.
What I'd really like to do is have the filter give a nice date selector, and/or a date range selector (similar to what you typically have on airline search sites for example).
SOLUTION:cbmyers wrote:Optimus,
do you have an example i can see of this:
Thanks,No but you can implement your own filtering by placing input yourself on column header.
Chris
Code: Select all
.calendarFilter .ui-inputfield
{
width:70px; !important;
margin: 0 0.2em; !important;
}
<f:facet name="header">
Date
<div style="display: block; width: 90%; margin: auto;">
<p:calendar id="firstDate" styleClass="calendarFilter" value="#{bean.minDate}">
<p:ajax event="dateSelect" listener="#{bean.filterDataTable()}" update="dataTableId" />
</p:calendar>
-
<p:calendar id="lastDate" styleClass="calendarFilter" value="#{bean.maxDate}">
<p:ajax event="dateSelect" listener="#{bean.filterDataTable()}" update="dataTableId" />
</p:calendar>
</div>
</f:facet>
1) It's important to wrap those calendars into a div with style=block for displaying the components bellow the header text.
2) Necessary apply style classes in order to display the components harmoniously.
3) I suggest specifying the column's width. (personally i like 200px in this case)
3) Div's width is set to 90% for making available the most possible space for the sorting click at the header cell. (when using sortBy)
Last edited by kingdan on 21 Jan 2012, 13:57, edited 3 times in total.
Move Fast, Break Things!
I read the manual but i couldn't figure out how to implement the filter method on javascript.optimus.prime wrote:No but you can implement your own filtering by placing input yourself on column header.
I didn't understand this:
"Filter located at header is a global one applying on all fields, this is implemented by calling client
side api method called filter(), important part is to specify the id of the input text as globalFilter
which is a reserved identifier for datatable."
Move Fast, Break Things!
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
I have been doing something very similar to this and this works as designed for me, and i had no need to ask Optimus.Prime for dataTable to do something like this, especially, since I use LazyDataModel a lot through JSF/Primefaces web app that I'm developing; per my experience, p:dataTable filterBy and sortBy does not work well with LazyDataModel, so i had to develop my own solution, and it works for me.kingdan wrote:SOLUTION:Notes:Code: Select all
.calendarFilter .ui-inputfield { width:70px; !important; margin: 0 0.2em; !important; } <f:facet name="header"> Date <div style="display: block; width: 90%; margin: auto;"> <p:calendar id="firstDate" styleClass="calendarFilter" value="#{bean.minDate}"> <p:ajax event="dateSelect" listener="#{bean.filterDataTable()}" update="dataTableId" /> </p:calendar> - <p:calendar id="lastDate" styleClass="calendarFilter" value="#{bean.maxDate}"> <p:ajax event="dateSelect" listener="#{bean.filterDataTable()}" update="dataTableId" /> </p:calendar> </div> </f:facet>
1) It's important to wrap those calendars into a div with style=block for displaying the components bellow the header text.
2) Necessary apply style classes in order to display the components harmoniously.
3) I suggest specifying the column's width. (personally i like 200px in this case)
3) Div's width is set to 90% for making available the most possible space for the sorting click at the header cell. (when using sortBy)
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
Hi, can you share your solution?
I'm working with lazydatamodel. The filter works well with strings, but I wanna put date interval, autocomplete, checks.
I'm working with lazydatamodel. The filter works well with strings, but I wanna put date interval, autocomplete, checks.
smithh032772 wrote:I have been doing something very similar to this and this works as designed for me, and i had no need to ask Optimus.Prime for dataTable to do something like this, especially, since I use LazyDataModel a lot through JSF/Primefaces web app that I'm developing; per my experience, p:dataTable filterBy and sortBy does not work well with LazyDataModel, so i had to develop my own solution, and it works for me.kingdan wrote:SOLUTION:Notes:Code: Select all
.calendarFilter .ui-inputfield { width:70px; !important; margin: 0 0.2em; !important; } <f:facet name="header"> Date <div style="display: block; width: 90%; margin: auto;"> <p:calendar id="firstDate" styleClass="calendarFilter" value="#{bean.minDate}"> <p:ajax event="dateSelect" listener="#{bean.filterDataTable()}" update="dataTableId" /> </p:calendar> - <p:calendar id="lastDate" styleClass="calendarFilter" value="#{bean.maxDate}"> <p:ajax event="dateSelect" listener="#{bean.filterDataTable()}" update="dataTableId" /> </p:calendar> </div> </f:facet>
1) It's important to wrap those calendars into a div with style=block for displaying the components bellow the header text.
2) Necessary apply style classes in order to display the components harmoniously.
3) I suggest specifying the column's width. (personally i like 200px in this case)
3) Div's width is set to 90% for making available the most possible space for the sorting click at the header cell. (when using sortBy)
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 48 guests