0

我的页面上有以下代码:

    <a4j:repeat value="#{tdController.cu.esaDoutCUConsigment.esaDoutCUDepartureArrivalTransport.transportMeans}" var="transportMean" rowKeyVar="idx">
              <tr>
                <td>
                    <rich:autocomplete id="transportMeansInactiveCountry#{idx}" mode="cachedAjax"
                                       autocompleteMethod="#{countryList.autoComplete}"
                                       minChars="1" layout="grid"
                                       var="country" fetchValue="#{country.code}" width="50px"
                                       inputClass="autoCompleteWidth20"
                                       immediate="true" autofill="true"
                                       value="#{transportMean.country}"
                                       converter="com.enfasis.eced.common.controller.converter.CountryConverterAutoComplete">
                        <h:outputFormat value="{0}({1})">
                            <f:param value="#{country.name}"/>
                            <f:param value="#{country.code}"/>
                        </h:outputFormat>

                        <a4j:ajax event="selectitem" execute="@this"
                                  render="transportMeansInactiveCountryCode#{idx}"/>
                    </rich:autocomplete>
                    <h:outputText id="transportMeansInactiveCountryCode#{idx}"
                                  value="#{transportMean.country.name}" style="margin-left:5px"/>
                </td>
                                    ...
   </a4j:repeat....

在 a4j:repeat 循环中,我通过在 id 名称末尾添加行索引来动态设置 id,例如 id="transportMeansInactiveCountryCode#{idx}"。

但是当我以这种方式设置 id 时,使用 id="transportMeansInactiveCountryCode#{idx}" 重新渲染元素不起作用。

我怎么解决这个问题?

4

1 回答 1

0

我认为您必须从 ID 属性中删除索引。它会自动为您生成索引。

要检查这一点,请运行您的页面,然后查看页面 HTML 源代码。你会发现组件 id 就像 <form_name>-<id>-<index> 注意:尝试将你的 aj:repeat 包含在 a 侧

于 2012-03-23T20:48:39.213 回答