我有一个问题,阿贾克斯更新UI:重复。重复(见code以下):更新来自外部的UI一个命令触发。变量 priceHour 需要计算其他价格(周,Monat ..)
I have a problem to ajax update an ui:repeat. The update is triggered from a commandButton outside the ui:repeat (see the code below). The variable priceHour is required to calculate the other prices (week, Monat..)
<h:form id="myForm">
<ui:repeat id="alvs" var="alv" value="#{myBean.allV}" >
<h:panelGroup rendered="#{alv.status == 'ON'}" >
<div class="pricing">
<h:outputText styleClass="bold" value="#{alv.shortName}: "/>
<p:inputText value="#{alv.priceHour}" id="hour" required="true" >
<f:convertNumber pattern="#.##" type="currency" />
</p:inputText>
<p:inputText value="#{alv.priceDay}" id="day" >
<f:convertNumber pattern="#.##" type="currency" />
</p:inputText>
<p:inputText value="#{alv.priceWeek}" id="week" >
<f:convertNumber pattern="#.##" type="currency" />
</p:inputText>
<p:inputText value="#{alv.priceMonth}" id="month" >
<f:convertNumber pattern="#.##" type="currency" />
</p:inputText>
</div>
</h:panelGroup>
<p:messages />
</ui:repeat>
<p:commandButton value="Calculator" actionListener="#{myBean.priceCalc}" process="@this,alvs:hour" update="alvs" />
</h:form >
当我按一下按钮没有任何反应和UI:重复和价格都没有更新。哪里不对? 我也试过更新myForm会:alvs,更新:myForm会:alvs:没什么 我使用primefaces 3.5 在此先感谢
When I click the button nothing happens and the ui:repeat and the prices are not updated. What is wrong? I tried also update"myForm:alvs", update":myForm:alvs": nothing! I'm using primefaces 3.5 Thanks in advance
推荐答案
UI:重复
不是渲染的成分,所以你不会看到在HTML中任何事情。不能更新的东西,不渲染。另外, UI:重复
甚至没有一个 ID
属性
ui:repeat
is not a rendered component, so you won't see anything in HTML about it. You can't update something that is not rendered. Also the ui:repeat
doesn't even have an id
attribute.
您需要换你的 UI:重复
一个组件内,如 H:panelGroup中
例如是这样的:
You need to wrap your ui:repeat
inside a component such as h:panelGroup
for example like this :
<h:panelGroup id="alvs">
<ui:repeat ...>
</ui:repeat>
</h:panelGroup>
而在你的按钮更新panelGroup中:
And update the panelgroup in your button :
<p:commandButton value="Calculator" actionListener="#{myBean.priceCalc}" process="@this,alvs" update="alvs" />
请注意,我已经删除了:一小时
,因为你不能spectify它,每个标识会为每个重复不同的
Notice that I've removed the :hour
since you can't spectify it, each IDs will be different for each repeat.
更多信息:
JSF 2.0用户界面:重复相关推荐
最新文章