A couple of problems:

1 - don't remove it. You should make it invisible (setVisible(false))

2 - you're trying to remove the container from the link, but it was added to 
the panel.  You would have to call IngredientPanel.this.remove (but don't)


Jeremy Thomerson
http://www.wickettraining.com
-- sent from a wireless device


-----Original Message-----
From: Martin Makundi <martin.maku...@koodaripalvelut.com>
Sent: Tuesday, February 03, 2009 12:16 AM
To: users@wicket.apache.org
Subject: Re: Component doesn't disappear when removing it via an ajax link

Run Wicket in development mode and investigate what happens in the
"Wicket Ajax Debug" dialog (right bottom corner of your browser).

**
Martin

2009/2/3 Azzeddine Daddah <waarhei...@gmail.com>:
> Hi,
> I've two text fields wrapped in a container. What I want to do is to let the
> user remove these fields via a link. This is my code which does not work.
> The wrapper container stills appear even the link is submitted:
>
> <html xmlns:wicket>
>    <wicket:panel>
>    <div wicket:id="container">
>    <input type="text" wicket:id="recipeIngredientQty" style="width: 15%;
> float: left; margin-right: 10px;"/>
>    <input type="text" wicket:id="recipeIngredient" style="width: 80%;
> margin-bottom: 7px;"/>
>    <a wicket:id="removeLink">[x]</a>
>    </div>
>    </wicket:panel>
> </html>
>
> public class IngredientPanel extends Panel {
>
>    /**
>     * Creates a new {...@link IngredientPanel}.
>     *
>     * @param id the panel id; may not be <code>null</code>
>     * @param model the panel model; may not be <code>null</code>
>     */
>    public IngredientPanel(String id, IModel<RecipeIngredient> model) {
>        super(id, model);
>        RecipeIngredient recipeIngredient = model.getObject();
>
>        final WebMarkupContainer container = new
> WebMarkupContainer("container", model);
>        container.setOutputMarkupId(true);
>        container.add(new RequiredTextField<String>("recipeIngredientQty",
> new Model<String>(recipeIngredient.getQuantity())));
>        container.add(new RequiredTextField<String>("recipeIngredient", new
> Model<String>(recipeIngredient.getIngredient().getName())));
>        container.add(new AjaxLink<Void>("removeLink") {
>            @Override
>            public void onClick(AjaxRequestTarget target) {
>                remove(container);
>            }
>        });
>        add(container);
>    }
> }
>
> Kind regards,
>
> Hbiloo
>

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



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

Reply via email to