[英]Primefaces - ui:repeat component does not update
I have a problem to ajax update an ui:repeat. 我有一个问题,ajax更新一个ui:重复。 The update is triggered from a commandButton outside the ui:repeat (see the code below).
更新是从ui:repeat之外的commandButton触发的(请参阅下面的代码)。 The variable priceHour is required to calculate the other prices (week, Monat..)
变量priceHour需要计算其他价格(周,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 >
When I click the button nothing happens and the ui:repeat and the prices are not updated. 当我点击按钮时没有任何反应和ui:重复,价格没有更新。 What is wrong?
怎么了?
I tried also update"myForm:alvs" , update":myForm:alvs" : nothing! 我也试过更新“myForm:alvs” , 更新“:myForm:alvs” :什么都没有!
I'm using primefaces 3.5 我正在使用primefaces 3.5
Thanks in advance 提前致谢
ui:repeat
is not a rendered component, so you won't see anything in HTML about it. ui:repeat
不是渲染组件,因此您不会在HTML中看到任何关于它的内容。 You can't update something that is not rendered. 您无法更新未呈现的内容。 Also the
ui:repeat
doesn't even have an id
attribute. ui:repeat
甚至没有id
属性。
You need to wrap your ui:repeat
inside a component such as h:panelGroup
for example like this : 你需要将你的
ui:repeat
包装在一个组件中,例如h:panelGroup
,例如:
<h:panelGroup id="alvs">
<ui:repeat ...>
</ui:repeat>
</h:panelGroup>
And update the panelgroup in your button : 并更新按钮中的面板组:
<p:commandButton value="Calculator" actionListener="#{myBean.priceCalc}" process="@this,alvs" update="alvs" />
Notice that I've removed the :hour
since you can't spectify it, each IDs will be different for each repeat. 请注意,我已删除了
:hour
因为您无法对其进行说明,每次重复时每个ID都会有所不同。
More info : 更多信息 :
I had the same problem. 我有同样的问题。 The proposed answers didn't work for me: the ui:repeat doesn't want to be updated by ajax, whatever I do.
建议的答案对我不起作用:ui:repeat不希望被ajax更新,无论我做什么。 I used PrimeFaces data list instead and it worked like a charm.
我使用PrimeFaces数据列表,它就像一个魅力。
http://www.primefaces.org/showcase/ui/data/dataList.xhtml http://www.primefaces.org/showcase/ui/data/dataList.xhtml
I'm afraid I don't know the reason for it to not work, I hate when that kind of stuff happens to me working with JSF. 我担心我不知道它不起作用的原因,我讨厌当我使用JSF时遇到这种情况。 As I workaround, you can try surrounding the
ui:repeat
with a p:outputPanel
and then update that panel. 当我解决方法时,您可以尝试围绕
ui:repeat
使用p:outputPanel
ui:repeat
,然后更新该面板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.