-
1. Re: Help!Updating a SelectOneMenu's choices based on the selection of another SelectOneMenu
nbelaevski Mar 14, 2010 6:46 AM (in response to markusnn)Hi,
Check a4j:support examples at livedemo.
-
2. Re: Help!Updating a SelectOneMenu's choices based on the selection of another SelectOneMenu
harut Mar 16, 2010 2:42 AM (in response to markusnn)1 of 1 people found this helpfulFor your case:
<a4j:keepAlive beanName="myBean"/> //if your bean is in request scope
<h:selectOneMenu id="A" value="...">
<f:selectItems value="#{myBean.selectItemsForA}" />
</h:selectOneMenu><h:selectOneMenu id="B" value="...">
.........<a4j:support event="onchange"
actionListener="#{myBean.modifySelectItemsOfA}"
reRender="A"/>
</h:selectOneMenu>---------------------------
public class MyBean {
private List<SelectItem> selectItemsForA;
.....................
public void modifySelectItemsOfA(ActionEvent event) {
//............. Business logic for changing SelectItems for "A"..................
selectItemsForA = ...;
}
}
-
3. Re: Help!Updating a SelectOneMenu's choices based on the selection of another SelectOneMenu
markusnn Mar 16, 2010 3:39 PM (in response to harut)Thanks
I guess it is difficult to do this kind of thing with a backing bean that is recreated in every request.
-
4. Re: Help!Updating a SelectOneMenu's choices based on the selection of another SelectOneMenu
harut Mar 17, 2010 2:41 AM (in response to markusnn)1 of 1 people found this helpfulI guess it is difficult to do this kind of thing with a backing bean that is recreated in every request.
If you will declare your bean as a4j:keepalive (as I mentioned in my previous post) then your bean will not be recreated in every request while you are in the same page...
-
5. Re: Help!Updating a SelectOneMenu's choices based on the selection of another SelectOneMenu
ilya_shaikovsky Mar 17, 2010 3:13 AM (in response to harut)and even more you could define that object should be stored only per ajax requests. So when for example you hitting normal h:command for submitting form - it will behaves as standard request scoped bean.