1
我正在使用PrimeFaces 2.2和JSF 2.0.3。JSF/Primefaces dataTable和排序问题
我有一个包含以下数据表中的XHTML视图:
<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>
..用下面的支持bean:
@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”,和DOB列中的“sortBy”。
我遇到了一个奇怪的问题,这似乎只限于IE,如果我按DOB对数据进行排序,然后分页到最后一页,然后单击表中最后一条记录的commandLink,它会触发两个行动事件。第一个事件正确地报告我点击了排序表中的最后一条记录。但next()方法的第二次调用是针对UNsorted表中的最后一条记录。
任何人都可以识别我的xhtml或支持bean有什么问题吗?这是一个已知的PrimeFaces问题吗?一个已知的IE问题?
我使用IE 8测试。
你使用的是什么pf版本? –
我不认为PF的版本已经被支持了。升级到3.3.X版本会更快乐。我甚至不认为cagatay会招待:) – kolossus
然后,我想我的问题是,是否有已知的问题与2.x的primefaces会导致这种类型的行为,并已在3.3.X解决这些问题?如果在3.3.X中发生这种相同的行为,那么我该怎么做? – 6006604