Mind that your code gets removed once it arrives to the list: a known
limitation of using nabble. I mean


 public ShoppingCartPanel(String id, Cart cart) {

        super(id);
        this.cart=cart;

        // make panel repaintable via AJAX.
        setOutputMarkupId(true)

        cartcomponent = new ListView<Cheese>("cart", new
PropertyModel<List<Cheese>>(this, "cart.cheeses")) {
            @Override
            protected void populateItem(ListItem<Cheese> item) {

                Cheese cheese = item.getModelObject();

                item.add(new Label("name", cheese.getName()));
                item.add(new Label("price", "$" +cheese.getPrice()));

                item.add(new AjaxFallbackLink<Cheese>("remove",
item.getModel()) {
                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        Cheese selected = (Cheese) getModelObject();
                        getCart().getCheeses().remove(selected);
                        if(target!=null){
                            target.add(ShoppingCartPanel.this);
                        }
                    }
                });
            }
        };
        add(cartcomponent);


On Mon, May 11, 2015 at 12:48 PM, Andreas <cinemat...@gmail.com> wrote:

> Hi,
> actualy I resolve it using a component wrapper, but I'm interesting in what
> you realy suggest.
>
> > You might need to qualify this with a name: MyPanel.this and also make
> > sure
> > your panel call setOutputMarkupId(true)
>
> What is MyPanel?
> Maybe you mean *Panel.this*?
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Refreshing-a-repeater-component-via-ajax-tp4670710p4670712.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro

Reply via email to