2013-06-02 2 views
4

날짜 사이의 일부 필드를 필터링해야하지만 primefaces는 아직 날짜 필터링을 지원하지 않습니다.primefaces 날짜 사이의 데이터 테이블

내가하는 기능을 수행하지만 ... 여기 내가 찾은 몇 가지 예를 얼마나 확실하지 메신저 수 있습니다 만 "보기"코드가

<f:facet name="header">DateRange 
    <div> 
    <p:calendar id="from" value="#{bean.from}" styleClass="calendarFilter"> 
     <p:ajax event="dateSelect" listener="#{ctrlr.filterDates()}" update="dataTableId"/> 
    </p:calendar> 
    <p:calendar id="to" value="#{bean.to}" styleClass="calendarFilter"> 
     <p:ajax event="dateSelect" listener="#{ctrlr.filterDates()}" update="dataTableId"/> 
    </p:calendar> 
    </div> 
</f:facet> 

, ID가는 것이 얼마나보고 싶어이 내 콩에서 필터링 기능.

모든 사례를 환영합니다 :)

감사합니다.

+0

가능한 복제본 [PF가 날짜가 포함 된 Datatable 열 필터링] (http://stackoverflow.com/questions/10846128/pf-filtering-a-datatable-column-which-contains-a-date) –

답변

3

다른 출력 패널에 날짜 필드를 유지하고 날짜에 따라 필터 버튼을 클릭하여 테이블을 업데이트하십시오.

<h:outputText value="FROM" /> 
<p:calendar id="strtdt" showOn="button" title="Start Date" size="12"   value="#{form.startDate}" navigator="true" showButtonPanel="true"> 
</p:calendar> 
<h:outputText value="TO" /> 
<p:calendar id="enddt" showOn="button" title="End Date" size="12" value="#{form.endDate}" 
navigator="true" showButtonPanel="true" > 
</p:calendar> 
<p:commandButton id="btnFilter" value="Filter" update="datatable" action="#{controller.update()}" ajax="true" /> 

컨트롤러 클래스에서 날짜 사이에 필요한 데이터를 가져오고 테이블 (또는 테이블을로드하는 목록)을 업데이트하는 코드를 작성하십시오. 희망이 도움이됩니다.

관련 문제