Re: Using AJAX to change style of component

2008-04-28 Thread Ryan O'Hara

Cool, that worked.  Thanks, Frank.

Ryan

On Apr 25, 2008, at 2:25 AM, Frank Bille wrote:


You have to set outMarkupId when creating the component. It's too late
to do it in the ajax callback.

Frank


On Thu, Apr 24, 2008 at 9:32 PM, Ryan O'Hara  
<[EMAIL PROTECTED]> wrote:
I'm fairly new to Wicket and was wondering if there is a way to  
use AJAX to
change the style of a WebMarkupContainer?  Below is a snippet of  
my code:


IModel sourceModel = new Model() {
public Object getObject() {
return sourceOptions;
}
};
final DropDownChoice source = new DropDownChoice("source",  
new

PropertyModel(this, "sourceSelection"), sourceModel);
source.add(new AjaxFormComponentUpdatingBehavior 
("onchange") {

protected void onUpdate(AjaxRequestTarget target) {
variationMetricRow.add(new AttributeModifier 
("style", true,

new Model(sourceSelection.equals("CHOP_Normals") ? "display:block" :
"display:none")));
variationMetricRow.setOutputMarkupId(true);
target.addComponent(variationMetricRow);
}
});

 In this example,  I would like to change the display to show/hide a
particular component.  Any help would be appreciated.

 Thanks,
 Ryan

  
-

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using AJAX to change style of component

2008-04-24 Thread Frank Bille
You have to set outMarkupId when creating the component. It's too late
to do it in the ajax callback.

Frank


On Thu, Apr 24, 2008 at 9:32 PM, Ryan O'Hara <[EMAIL PROTECTED]> wrote:
> I'm fairly new to Wicket and was wondering if there is a way to use AJAX to
> change the style of a WebMarkupContainer?  Below is a snippet of my code:
>
> IModel sourceModel = new Model() {
> public Object getObject() {
> return sourceOptions;
> }
> };
> final DropDownChoice source = new DropDownChoice("source", new
> PropertyModel(this, "sourceSelection"), sourceModel);
> source.add(new AjaxFormComponentUpdatingBehavior("onchange") {
> protected void onUpdate(AjaxRequestTarget target) {
> variationMetricRow.add(new AttributeModifier("style", true,
> new Model(sourceSelection.equals("CHOP_Normals") ? "display:block" :
> "display:none")));
> variationMetricRow.setOutputMarkupId(true);
> target.addComponent(variationMetricRow);
> }
> });
>
>  In this example,  I would like to change the display to show/hide a
> particular component.  Any help would be appreciated.
>
>  Thanks,
>  Ryan
>
>  -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Using AJAX to change style of component

2008-04-24 Thread Ryan O'Hara
I'm fairly new to Wicket and was wondering if there is a way to use  
AJAX to change the style of a WebMarkupContainer?  Below is a snippet  
of my code:


IModel sourceModel = new Model() {
public Object getObject() {
return sourceOptions;
}
};
final DropDownChoice source = new DropDownChoice("source",  
new PropertyModel(this, "sourceSelection"), sourceModel);

source.add(new AjaxFormComponentUpdatingBehavior("onchange") {
protected void onUpdate(AjaxRequestTarget target) {
variationMetricRow.add(new AttributeModifier 
("style", true, new Model(sourceSelection.equals("CHOP_Normals") ?  
"display:block" : "display:none")));

variationMetricRow.setOutputMarkupId(true);
target.addComponent(variationMetricRow);
}
});

In this example,  I would like to change the display to show/hide a  
particular component.  Any help would be appreciated.


Thanks,
Ryan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]