Which is the best way to manage the visibility of a component?

2012-07-29 Thread Alberto
Hi,

I'm using wicket 1.5.7 and I have the following scenario.
A page with two DropDownChoice that we will call A and B. Values of B
depend on value of A and are updated by Ajax.
Then a WebMarkupContainer component that we will call C. The visibility
of C depends on value of B.
I added in the method onUpdate of
AjaxFormComponentUpdatingBehavior(onchange) of B some statements  to
check the value of B and set the visibility of C accordingly.
But it's triggered only when the user change the value of B. That value
can be changed by ajax when the user change the value of A.
So, which is the best practice to deal with this kind of problem?
I have to add the same code in the
AjaxFormComponentUpdatingBehavior(onchange) of A too? Is there a
better solution avoiding duplication of code?

Best regards

Alberto

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Which is the best way to manage the visibility of a component?

2012-07-29 Thread kshitiz
You can write the code in a separate method and call that method from A and
B...



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Which-is-the-best-way-to-manage-the-visibility-of-a-component-tp4650853p4650854.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Which is the best way to manage the visibility of a component?

2012-07-29 Thread Dan Retzlaff
You could override C's onConfigure() to set its visibility based on B, and
override C's onEvent() to add C to the ART if it's current visibility is
wrong.
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Defaultajaxevent

On Sun, Jul 29, 2012 at 6:17 AM, Alberto abros...@ogs.trieste.it wrote:

 Hi,

 I'm using wicket 1.5.7 and I have the following scenario.
 A page with two DropDownChoice that we will call A and B. Values of B
 depend on value of A and are updated by Ajax.
 Then a WebMarkupContainer component that we will call C. The visibility
 of C depends on value of B.
 I added in the method onUpdate of
 AjaxFormComponentUpdatingBehavior(onchange) of B some statements  to
 check the value of B and set the visibility of C accordingly.
 But it's triggered only when the user change the value of B. That value
 can be changed by ajax when the user change the value of A.
 So, which is the best practice to deal with this kind of problem?
 I have to add the same code in the
 AjaxFormComponentUpdatingBehavior(onchange) of A too? Is there a
 better solution avoiding duplication of code?

 Best regards

 Alberto

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org