0

已编辑

我想显示一个 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>

模型声明ReglementaireModel

@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;
}


}

模型详情DecRegModel

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 ;
}

}
4

1 回答 1

1

设置clientRows您的属性<rich:extendedDataTable/>以指定在初始页面加载时要加载到客户端的初始行数。同一数据表的后续滚动将使用相同的数字增加可用的行数。

     <rich:extendedDataTable value="#{bean.items}" clientRows="15"/>

这种用法的前提是整个数据集已加载到服务器端。

如果您需要对服务器端的数据加载进行更细粒度的控制,您应该实现一个ExtendedDataModel来控制数据加载。

有关的:

于 2013-05-31T17:04:59.273 回答