简体   繁体   English

rich:extendedDataTable,带有动态列

[英]rich:extendedDataTable with dynamic columns

I want to fill a rich:extendedDataTable with a static columns and dynamic columns in RichFaces 4.2 我想在RichFaces 4.2中用静态列和动态列填充rich:extendedDataTable

I tried following code,but it's not working for me : 我尝试了以下代码,但是对我来说不起作用:

            <rich:extendedDataTable id="listDipRec"
                iterationStatusVar="itDipRec" rows="200"
                value="#{declarationReglementaireModel.detailCurrentDecReg.decReg.listLigneDipRecsDTO}"
                var="ligneDipRec" frozenColumns="1"
                style="height:300px; width:800px;" selectionMode="none">

                <rich:column width="35px">
                    <h:panelGrid columns="1" cellpadding="2">
                        <a4j:commandLink render="editGridDipRec" execute="@this"
                            oncomplete="#{rich:component('modifDipRec')}.show()">
                            <span class="icone icone-edit icone-align-center" />
                            <a4j:param value="#{itDipRec.index}"
                                assignTo="#{declarationReglementaireModel.currentLigneDipRecIndex}" />
                            <f:setPropertyActionListener
                                target="#{declarationReglementaireModel.currentLigneDipRec}"
                                value="#{ligneDipRec}" />
                        </a4j:commandLink>

                    </h:panelGrid>
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="Date ligne fichier Dip" />
                    </f:facet>
                    <h:outputText value="#{ligneDipRec.dtLigneDipRec}">
                        <f:convertDateTime pattern="dd/MM/yyyy" timeZone="Europe/Paris" />
                    </h:outputText>
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="Référence titre" />
                    </f:facet>
                    <h:outputText value="#{ligneDipRec.rfTitre}">
                    </h:outputText>
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputText value="Origine titre" />
                    </f:facet>
                    <h:outputText value="#{ligneDipRec.lbOrigineLigne}">
                    </h:outputText>
                </rich:column>

                <c:forEach items="#{ligneDipRec.listDonneeDipRecDTO}" var="column"
                    varStatus="status">
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Valeur rubrique" />
                        </f:facet>
                        <h:outputText value="#{declarationReglementaireModel.getColumnData(ligneDipRec,column).lbValeurRubrique}" />
                    </rich:column>
                </c:forEach>

            </rich:extendedDataTable>

<c:forEach> doesn't have access to the table's variables (ie ligneDipRec ), and unfortunately you can't do anything about it. <c:forEach>无法访问表的变量(即ligneDipRec ),不幸的是,您对此无能为力。

The good news is that whatever you put inside the forEach will have access to those variables. 好消息是,无论您将什么放入forEach都可以访问这些变量。 The only thing you need to do is to save the size of the list somewhere in the bean and then loop over it, rather than over the variable: 您唯一需要做的就是将列表的大小保存在bean中的某个位置,然后在其上循环,而不是在变量上循环:

<c:forEach var="columnNumber" begin="0" 
  end="{declarationReglementaireModel.detailCurrentDecReg.decReg.listSize - 1}"> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM