【发布时间】:2012-02-27 14:48:00
【问题描述】:
我在一张桌子上有一个 ui:repeat 拍卖物品。它是一个常规的 html 表格,因为当您单击 Bid commandLink 时,会在所选拍卖项目的正下方打开一行,并显示一个投标组件。 Bid commandLink 正在使用这样的 ajax:
<f:ajax listener="#{bean.addBidView(lot)}" render="bidView" />
addBidView 正在更新auctionItems 的地图,这就是打开正确选定行的方式。当用户再次点击相同的 Bid 链接时,addBidView 会计算出来并关闭出价组件。
现在假设用户点击了几行,从而打开了几个出价组件。它们都打开,但只有一个处于活动状态。所以这是我的问题:当我使用上面的 ajax 时,如何让整个循环呈现,以便打开一个投标组件会自动关闭其他打开的组件。 (拍卖品地图反映了正确的出价组件,但是只渲染了这一个出价区域,所以其他的不受影响。如果我刷新整个页面,显示是正确的,只有当我我正在使用 ajax。)
这是页面上元素的结构(所有这些都在 h:form 中:)
<table id="bidstable">
<h:panelGroup id="entireLoop">
<ui:repeat id="repeatAuctionItems" var="auctionItem" varStatus="status" value="#{bean.auctionItems}">
<td>... a bunch of td's with the auction item values ... and then:
<h:commandLink id="bid" rendered="#{some conditions}">
<f:ajax listener="#{bean.addBidView(auctionItem)}" render="bidView"/>
</h:commandLink>
</td>
</ui:repeat>
</h:panelGroup>
</table>
我几乎尝试了“渲染”中的所有元素组合——例如:
render="bidView bidsTable"
或 render="bidView bidsTable:entireLoop:repeateAuctionItems"
以及我能想到的所有其他线索。没有任何效果。有任何想法吗?
【问题讨论】:
标签: jsf-2