被修改
我想显示一个包含40列和1000行的可滚动表。
我使用rich:extendedDataTable
(我正在使用richfaces 4)与clientRows="20"
,但我得到一个包含20行的表,当我滚动时,只是这些行被更新,我没有得到新的行!
XHTML
<rich:extendedDataTable id="idList"
value="#{declarationReglementaireModel.detailCurrentDecReg.decReg.listLigneTa3SDTO}"
var="ligneTA3" frozenColumns="2" style="height:300px; width:800px;"
selectionMode="none" clientRows="15">
<rich:column width="35px">
<h:panelGrid columns="1" cellpadding="2">
<h:commandLink action="#{rechercheDecRgltCtrl.afficherDetail}"
class="lien_detail">
<span class="icone icone-edit icone-align-center" />
<f:setPropertyActionListener
target="#{declarationReglementaireModel.detailCurrentDecReg.decReg.listLigneTa3SDTO}"
value="#{ligneTA3}" />
</h:commandLink>
</h:panelGrid>
</rich:column>
<rich:column width="150px" sortBy="#{ligneTA3.idTitre}"
sortOrder="ascending">
<f:facet name="header">Référence Titre</f:facet>
<h:outputText value="#{ligneTA3.idTitre}">
</h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="a" />
</f:facet>
<h:outputText value="#{ligneTA3.vlColA}">
</h:outputText>
</rich:column>
...
</rich:extendedDataTable>
模型DeclarationReglementaireModel
@ManagedBean(name="declarationReglementaireModel")
@SessionScoped
public class DeclarationReglementaireModel implements Serializable {
private static final long serialVersionUID = 1L;
private long test ;
private LigneDecRegSortieDTO currentDecReg ;
private List<LigneDecRegSortieDTO> listDecReg ;
private DetailDecRegModel detailCurrentDecReg ;
private Integer selectedPage;
public LigneDecRegSortieDTO getCurrentDecReg() {
return currentDecReg;
}
public void setCurrentDecReg(LigneDecRegSortieDTO currentDecReg) {
this.currentDecReg = currentDecReg;
}
public List<LigneDecRegSortieDTO> getListDecReg() {
if(this.listDecReg == null){
this.listDecReg = new ArrayList<LigneDecRegSortieDTO>() ;
}
return listDecReg;
}
public void setListDecReg(List<LigneDecRegSortieDTO> listDecReg) {
this.listDecReg = listDecReg;
}
public long getTest() {
return test;
}
public DetailDecRegModel getDetailCurrentDecReg() {
return detailCurrentDecReg;
}
public void setDetailCurrentDecReg(DetailDecRegModel detailCurrentDecReg) {
this.detailCurrentDecReg = detailCurrentDecReg;
}
public void setTest(long test) {
this.test = test;
}
public void init(){
listDecReg = null ;
currentDecReg = null ;
detailCurrentDecReg = null ;
this.selectedPage = null ;
}
public Integer getSelectedPage() {
if (this.selectedPage == null)
this.selectedPage = 1;
return this.selectedPage;
}
public void setselectedPage(Integer numPage) {
this.selectedPage = numPage;
}
}
Model DetailDecRegModel
public class DetailDecRegModel implements Serializable {
private static final long serialVersionUID = 1L;
private DecRegDTO decReg ;
private TypeDecRegDTO typeDecReg ;
private int nbreLignes ;
public static final int DIR_IRREG = 1 ;
public static final int GLD_CLA = 2 ;
public static final int GLD_PERIODE = 3 ;
public static final int TAB_A3 = 4 ;
public static final int TAB_A3_BIS = 5 ;
public static final int DIR_AUTRES = 6 ;
public DetailDecRegModel() {
super();
}
public DetailDecRegModel(DecRegDTO detailCurrentDecReg,
TypeDecRegDTO typeDecReg) {
super();
this.decReg = detailCurrentDecReg;
this.typeDecReg = typeDecReg;
}
public DecRegDTO getDecReg() {
return decReg;
}
public void setDecReg(DecRegDTO decReg) {
this.decReg = decReg;
}
public TypeDecRegDTO getTypeDecReg() {
return typeDecReg;
}
public void setTypeDecReg(TypeDecRegDTO typeDecReg) {
this.typeDecReg = typeDecReg;
}
public int getNbreLignes() {
switch ((int)getTypeDecReg().getIdTypeDecReg()){
case DIR_IRREG:
this.nbreLignes = decReg.getListLigneDipRecsDTO().size() ;
break;
case GLD_CLA:
this.nbreLignes = decReg.getListLigneGldsDTO().size() ;
break;
case GLD_PERIODE:
this.nbreLignes = decReg.getListLigneGldsDTO().size() ;
break;
case TAB_A3:
this.nbreLignes = decReg.getListLigneTa3SDTO().size();
break;
case TAB_A3_BIS:
this.nbreLignes = decReg.getListLigneTa3SDTO().size();
break;
case DIR_AUTRES:
this.nbreLignes = decReg.getListLigneDipRecsDTO().size() ;
break;
}
return nbreLignes;
}
public void setNbreLignes(int nbreLignes) {
this.nbreLignes = nbreLignes;
}
//public boolean isDecRegTypeDipRec(){
public boolean isDecRegTypeDirIrreg(){
return typeDecReg != null && (int)typeDecReg.getIdTypeDecReg() == DIR_IRREG ;
}
public boolean isDecRegTypeDirAutres(){
return typeDecReg != null && (int)typeDecReg.getIdTypeDecReg() == DIR_AUTRES ;
}
public boolean isDecRegTypeGldPer(){
return typeDecReg != null && (int)typeDecReg.getIdTypeDecReg() == GLD_PERIODE ;
}
public boolean isDecRegTypeGldCla(){
return typeDecReg != null && (int)typeDecReg.getIdTypeDecReg() == GLD_CLA ;
}
public boolean isDecRegTypeTabA3(){
return typeDecReg != null && (int)typeDecReg.getIdTypeDecReg() == TAB_A3 ;
}
public boolean isDecRegTypeTabA3Bis(){
return typeDecReg != null && (int)typeDecReg.getIdTypeDecReg() == TAB_A3_BIS ;
}
}
答案 0 :(得分:1)
在clientRows
上设置<rich:extendedDataTable/>
属性,以指定在初始页面加载时要加载到客户端的初始行数。相同数据表的后续滚动将使用相同的数字增加可用的行。
<rich:extendedDataTable value="#{bean.items}" clientRows="15"/>
此用法预先假定已在服务器端加载整个数据集。
如果您需要对服务器端的数据加载进行更精细的控制,则应实施ExtendedDataModel
来控制数据加载。
相关: