You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by fh...@s-und-n.de on 2007/08/24 14:24:11 UTC

conditional markup change with AjaxEditableLabel

Hi, 

i am using a subclass of AjaxEditableLabel.
This one works fine so far but I have one Problem.

If the value of the label is < 0 the markup should change.
I tried it this way with no effect.

public class MyAjaxEditableLabel extends AjaxEditableLabel{

protected void onSubmit(AjaxRequestTarget target)
{
        [...]
        if(position.getValue()[index] < 0)
        {
                this.getLabel().add(new AttributeModifier("class", true, 
new Model("negativ")));
        }
        else{
                this.getLabel().add(new AttributeModifier("class", true, 
new Model("positiv")));
        }

        this.getLabel().setVisible(true);
        this.getEditor().setVisible(false);
        target.addComponent(MyAjaxEditableLabel.this);
}

}

In my css - stylesheet the class "negativ" and "positv" are defined.
So if the value of the label changes to < 0 nothing happens.

Any suggestions?

Fabian

Re: conditional markup change with AjaxEditableLabel

Posted by Eelco Hillenius <ee...@gmail.com>.
On 8/24/07, fhagen@s-und-n.de <fh...@s-und-n.de> wrote:
> Hi,
>
> i am using a subclass of AjaxEditableLabel.
> This one works fine so far but I have one Problem.
>
> If the value of the label is < 0 the markup should change.
> I tried it this way with no effect.
>
> public class MyAjaxEditableLabel extends AjaxEditableLabel{
>
> protected void onSubmit(AjaxRequestTarget target)
> {
>         [...]
>         if(position.getValue()[index] < 0)
>         {
>                 this.getLabel().add(new AttributeModifier("class", true,
> new Model("negativ")));
>         }
>         else{
>                 this.getLabel().add(new AttributeModifier("class", true,
> new Model("positiv")));
>         }
>
>         this.getLabel().setVisible(true);
>         this.getEditor().setVisible(false);
>         target.addComponent(MyAjaxEditableLabel.this);
> }
>
> }
>
> In my css - stylesheet the class "negativ" and "positv" are defined.
> So if the value of the label changes to < 0 nothing happens.
>
> Any suggestions?

If I recall correctly, attribute changes not rendered correctly with
ajax requests was an issue that was recently solved. Matej, was that
you who fixed it?

Eelco

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