I have a panel that displays a product info :

public class ProductDetails extends Panel {
        private IModel<Product> model;
        public ProductDetails(String id, Product product) {
                super(id);
                setOutputMarkupId(true);
                this.setCurrentProduct(product);
                
                add(new Label("id", new PropertyModel<String>(model, "id")));

                add(new Label("codProduct", new 
PropertyModel<String>(this.model,
                                "codProduct")));

                add(new Label("tpVat", new PropertyModel<String>(this.model, 
"tpVat")));
        }

        public void setCurrentProduct(Product product) {
                this.model = new CompoundPropertyModel<Product>(product);
        }
}

I am trying to update it from a link in another panel:

        AjaxLink<String> link = new AjaxLink<String>("link") {
                                        {
                                                add(new Label("id", new 
PropertyModel<String>(model,
                                                                "id")));
                                        }
                                        @Override
                                        public void onClick(AjaxRequestTarget 
target) {
                                                Product product = 
item.getModelObject();
                                                
productDetails.setCurrentProduct(product);
                                                
target.addComponent(productDetails);
                                                
System.out.println(target.toString());
                                        }
                                };
                                item.add(link);


Updates are not shown. I believe the issue is with the Model I am
using (IModel<Product>). However, I don't know the alternative model I
should be using (if it's a model issue).
Product is a JPA entity.
Any ideas ? example ?

thanx

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

Reply via email to