-
1. Re: question
quilleashm Apr 5, 2007 5:19 AM (in response to adrian.iacob)Conditionally render the other components using the rendered property, I've just set the second combo to show when the first's value is set to not-null. Then add the <a4j:support> and tell it which event to trap and which control you wish to reRender.
This is the basics, you should read the docs for more info and options.<h:selectOneMenu id="selectOneCar" value="#{carBean.currentCar}"> <f:selectItems value="#{carBean.carList}" /> <a4j:support event="onchange" reRender="selectAnotherThing"/> </h:selectOneMenu> <h:selectOneMenu id="selectAnotherThing" value="#{carBean.otherThing}" rendered="#{carBean.currentCar != null}"> <f:selectItems value="#{carBean.otherThings}" /> </h:selectOneMenu>
HTH.
Mike. -
2. Re: question
adrian.iacob Apr 5, 2007 6:07 AM (in response to adrian.iacob)The problem here is that I don't know whether I have one selectOneMenu or 10 selectOneMenu .
let me give you an example of what I have in my head instead of carBean I will call controllerBean that has another bean calling it genericBean, This genericBean can be for example an Event bean (that has let us say 3 combo - year, month, day) or it can be a Computer bean (that has 5 combo - cpu, motherboard, optical, monitor, hard) (please remember this is an example, ignore the fact that hard, optical or motherboard are not really linked together)
and you would hard code like this<h:selectOneMenu id="selectFirstProperty" value="#{controllerBean.genericBean.year}"> <f:selectItems value="#{controllerBean.genericBean.yearList}" /> <a4j:support event="onchange" reRender="selectSecondThing"/> </h:selectOneMenu> <h:selectOneMenu id="selectSecondProperty" value="#{controllerBean.genericBean.month}"> <f:selectItems value="#{controllerBean.genericBean.monthList}" rendered="#{controllerBean.genericBean.year != null}/> <a4j:support event="onchange" reRender="selectThirdThing"/> </h:selectOneMenu> <h:selectOneMenu id="selectThirdProperty" value="#{controllerBean.genericBean.day}"> <f:selectItems value="#{controllerBean.genericBean.dayList}" rendered="#{controllerBean.genericBean.month != null}/> </h:selectOneMenu>
and the same would repeat itself for the Computer Bean.
I have the list of properties for Event of Computer that would be ["year","month","day"] and ["cpu","motherboard","optical","monitor","hard"]
and I am thinking of something likevalue="#{controllerBean.genericBean[property]}" and rendered="#{controllerBean.genericBean[previousProperty]"
somehow on a loop :D -
3. Re: question
ilya_shaikovsky Apr 5, 2007 7:18 AM (in response to adrian.iacob)Use select controls inside repeats and point its values to your model bean.
And, Guys, also do not remember that you must reRender wrapper components but not a component that influenced by rendered attribute -
4. Re: question
quilleashm Apr 5, 2007 8:49 AM (in response to adrian.iacob)"ilya_shaikovsky" wrote:
And, Guys, also do not remember that you must <b>reRender</b> wrapper components but not a component that influenced by <b>rendered</b> attribute
Oops, forgot about that, my bad. -
5. Re: question
adrian.iacob Apr 5, 2007 8:51 AM (in response to adrian.iacob)please give more details... I know what I want, I hope I was clear. I don't know how !... So please give more details what repeats (I would love a fully functional example!)
-
6. Re: question
ilya_shaikovsky Apr 5, 2007 10:08 AM (in response to adrian.iacob)download full examples at examples page http://labs.jboss.com/portal/jbossajax4jsf/demo/index.html