【问题标题】:a4j:repeat tag is not workinga4j:重复标签不起作用
【发布时间】:2014-12-19 19:04:05
【问题描述】:
<a4j:form id="customerForm1" binding="#{customerForm.form}"
          ajaxSubmit="false">

    <h:inputHidden id="id" value="#{customerForm.customer.id}" />

    <rich:panel id="purchaseOrderList"
                styleClass="dataTablePanelStyle">
        <a4j:outputPanel id="table">
            <table border="1" width="100%">
                <thead>
                    <tr align="center">

                        <th width="8%"><h:outputText id="headerq"
                                      value="#{msg.distance}" styleClass="boldOutputTextStyle" /></th>
                        <th width="2%"><h:outputText id="ds8" value="" /></th>

                    </tr>
                </thead>
                <tbody>
                    <a4j:repeat
                        value="#{customerForm.customer.distanceTravelledList}"
                        var="purchaseOrderDetails" rowClasses="row1, row2">
                        <tr class="#{(rowIndex mod 2 eq 0)? 'row1' : 'row2'}">
                            <td align="center" width="10%">
                                <h:inputText id="distance" size="5" required="true"
                                             value="#{purchaseOrderDetails.distance}"
                                             styleClass="inputTextStyle">

                                </h:inputText>
                            </td>
                            <td><a4j:commandButton value="+"
                                               action="#{customerForm.addDistanceTravelled}"
                                               reRender="purchaseOrderList">
                                </a4j:commandButton></td>

                        </tr>
                    </a4j:repeat>
                </tbody>
            </table>
        </a4j:outputPanel>
    </rich:panel>
</a4j:form>

我创建了一个使用 a4j:repeat 标记的表,以便用户可以根据他的要求动态添加行。但是当我删除此标记时,即 a4j:repeat 前端仅显示一行,即两列名称和输入文本字段.. 但是当我添加 a4j:repeat` 时,只显示列名称,即距离...任何人都可以告诉我我错过了什么吗??

【问题讨论】:

  • 你可以使用 rich:dataTable 代替 a4j:repeat
  • @newuser 谢谢你的建议.. 但是有什么方法可以让 dis 代码工作吗??..
  • 我已经使用了相同的类型,但对我来说效果很好。

标签: jsf ajax4jsf


【解决方案1】:

试试这个,我正在为我的流程使用这样的表格。它对我来说很好,它可能对你有帮助。

<table border="1" width="100%">
<thead>
    <tr align="center">

        <th width="8%"><h:outputText id="headerq"
                      value="#{msg.distance}" styleClass="boldOutputTextStyle" /></th>
        <th width="2%"><h:outputText id="ds8" value="" /></th>

    </tr>
</thead>
<tbody>
    <a4j:repeat
        value="#{customerForm.customer.distanceTravelledList}"
        var="purchaseOrderDetails" rowKeyVar="rowIndex">
        <tr>
            <td align="center" width="10%">
                <h:inputText id="distance" required="true"
                             value="#{purchaseOrderDetails.distance}"
                             styleClass="inputTextStyle">
                </h:inputText>
            </td>
            <td><a4j:commandButton value="+"
                               action="#{customerForm.addDistanceTravelled}"
                               reRender="purchaseOrderList">
                </a4j:commandButton></td>
        </tr>
    </a4j:repeat>
</tbody>

【讨论】:

  • 您只需删除 rowClass 然后运行它。我试过你的来源,它对我来说很好。我更新了工作源。
  • 非常感谢您抽出宝贵的时间.. 但是即使粘贴了您的代码..结果仍然相同.. 您认为这是因为任何版本问题..?我在弹出窗口中显示此表.. 即 Rich:modalPanel..
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-27
  • 2018-09-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-25
相关资源
最近更新 更多