开发者

<p:ajax event="change"> wont work on runtime generated data

开发者 https://www.devze.com 2023-01-06 14:00 出处:网络
I have this: <h:selectOneMenu id=\"facility\" value=\"#{document.facility}\"> <f:selectItem itemLabel=\"A\" itemValue=\"\"/>

I have this:

<h:selectOneMenu id="facility" value="#{document.facility}">
     <f:selectItem itemLabel="A" itemValue=""/>
     开发者_如何学JAVA<f:selectItem itemLabel="B" itemValue=""/>
     <f:selectItems value="#{document.facilities}"/>
     <p:ajax actionListener="#{document.test}" update="project" event="change"/>
</h:selectOneMenu>

document is the managed bean, that has method getFacilities() that return a list of items, let say C, D, F. So the drop down list would be like:

A
B
C
D
F

If I click on B, then the method test() would get invoke. I log it. But if I click on the runtime generated data C, D, F, then the method test() did not invoke at all. How can I fix this?


The scope of the Managed Bean has to be at least ViewScoped, if u leave the scope by default, which is RequestScoped, it will not work

0

精彩评论

暂无评论...
验证码 换一张
取 消