2012-10-10 4 views
1

JSF 2.0.3과 함께 PrimeFaces 2.2를 사용하고 있습니다.JSF/Primefaces 데이터 테이블 및 정렬 문제

나는 다음과 같은 데이터 테이블을 포함하는 XHTML보기가 있습니다

 

@ViewScoped 
@ManagedBean 
public class FooQueue extends BaseViewBean { 

    private List foos; 
    private Foo selectedFoo; 
    private List filterdFoos; 

    public FooQueue() { 
     logger.debug("Creating new FooRegQueue"); 
     retrieveFooRecords(); 
    } 

    private void retrieveFooRecords(){ 
     foos = new ArrayList(); 
     foos.addAll(fooService.getAllFoos()); 
    } 

    public String next(Foo clickedFoo) {   
     System.out.println(clickedFoo.getId());  
     return ""; 
    } 

    public Collection getFoos() { 
     return foos; 
    } 

    public Foo getSelectedFoo() { 
     return selectedFoo; 
    } 

    public void setSelectedFoo(Foo foo) { 
     if (foo != null) { 
      this.selectedFoo = foo; 
     } 
    } 

    public void setFilterdFoos(List filterdFoos) { 
     this.filterdFoos = filterdFoos; 
    } 

    public List getFilterdFoos() { 
     return filterdFoos; 
    } 
} 
 

주 어머니의 이름 열에서 "CommandLink는"하고 다음 백업 콩

<p:dataTable id="fooTable" 
    widgetVar="fooTable" 
    rowKey="#{foo.id}" 
    var="foo" 
    value="#{fooQueue.foos}" 
    styleClass="table" 
    selection="#{fooQueue.selectedfoo}" 
    filteredValue="#{fooQueue.filteredfoos}" 
    paginatorPosition="bottom" 
    paginatorAlwaysVisible="true" 
    selectionMode="single" 
    rowEditListener="#{fooQueue.save}" 
    paginator="true" 
    rows="10" 
    rowIndexVar="#{foo.id}" 
    emptyMessage="No foos found with given criteria" 
    rowStyleClass="#{foo.status == const.submitted ? 'gray' : null}" 
    onRowSelectUpdate=":form:deleteValidation"> 

     <p:column id="mothersName" filterBy="#{foo.header1}" filterMatchMode="contains"> 
      <f:facet name="header"> 
       <h:outputText value="Mother's Name" styleClass="tableHeader2" /> 
      </f:facet> 

      <p:commandLink action="#{fooQueue.next(foo)}" 
       ajax="false" 
       disabled="#{foo.status == const.submitted || foo.id == 0}"> 
       <f:setPropertyActionListener value="#{foo}" target="#{fooQueue.selectedfoo}" /> 
       <h:outputText value="#{foo.header1}" styleClass="tableData" /> 
      </p:commandLink> 
     </p:column> 

     <p:column sortBy="#{foo.header4}" > 
      <f:facet name="header"> 
       <h:outputText value="DOB" styleClass="tableHeader2" style="width: 400px" /> 
      </f:facet> 
      <h:outputText value="#{foo.header4}" styleClass="#{(foo.overSevenDays and foo.status != const.submitted and foo.id != 0)?'tableDataRed':'tableData'}" /> 
     </p:column></p:dataTable> 
.. DOB 열의 "sortBy".

IE에 국한된 것으로 보이는 이상한 문제가 발생했습니다. DOB로 데이터를 정렬 한 다음 마지막 페이지로 페이지를 이동하고 테이블의 마지막 레코드의 commandLink를 클릭하면 두 개가 실행됩니다 액션 이벤트. 첫 번째 이벤트는 내가 정렬 된 테이블의 마지막 레코드를 클릭했다는 것을 올바르게보고합니다. 그러나 next() 메서드의 두 번째 호출은 UNSorted 테이블의 마지막 레코드에 대한 것입니다.

누구나 내 xhtml 또는 backing bean에 문제가 있다고 식별 할 수 있습니까? 이것이 알려진 PrimeFaces 문제입니까? 알려진 IE 문제?

나는 IE 8로 테스트 중이다.

+0

어떤 버전의 pf를 사용하고 있습니까? –

+0

PF 버전이 더 이상 지원되지 않는다고 생각합니다. 3.3.X 버전으로 업그레이드하는 것이 더 행복 할 것입니다. 나는 cagatay가 이것을 즐겁게 해줄 것이라고 생각지 않는다. : – kolossus

+0

그럼 내 질문에이 유형의 행동으로 이어질 primefaces의 버전 2.x에 관한 알려진 문제점이 있었고 그 문제는 3.3.X에서 해결 되었습니까? 3.3.X에서 이와 동일한 문제가 발생하면 어떻게해야합니까? – 6006604

답변

1

나는 그것을 풀었다. 간단히 말해서 나는 이것을 변경했다 : 이것에

<p:commandLink action="#{fooQueue.next(foo)}" 
    ajax="false" 
    disabled="#{foo.status == const.submitted || foo.id == 0}"> 
    <f:setPropertyActionListener value="#{foo}" target="#{fooQueue.selectedfoo}" /> 
    <h:outputText value="#{foo.header1}" styleClass="tableData" /> 
</p:commandLink> 

:

<p:commandLink action="#{fooQueue.next(foo)}" 
    ajax="true" 
    disabled="#{foo.status == const.submitted || foo.id == 0}"> 
    <f:setPropertyActionListener value="#{foo}" target="#{fooQueue.selectedfoo}" /> 
    <h:outputText value="#{foo.header1}" styleClass="tableData" /> 
</p:commandLink> 

참고 아약스 = "true"를합니다. 이전에 ajax = "false"로 설정되어 있었기 때문에 내 Backing Bean의 새 인스턴스를 인스턴스화하고 기본 정렬 순서로 선택한 행이로드되고있었습니다. 이제는 새 인스턴스를 인스턴스화하지 않고 클릭 한 실제 레코드를로드합니다.