Hello Martrin, and Ernesto,
it's still not working. I have this ProductPanel to be updated and
(possibly edited). It shows the product info when an item is clicked.
Here's the code for the Product Panel:

public class ProductDetails extends Panel {

        @EJB
        private ProductServicesLocal productServices;

        public ProductDetails(String id, final Product product) {
                super(id);
                setOutputMarkupId(true);
                this.setCurrentProduct(product);
                add(new Label("id"));

                add(new AjaxEditableLabel<String>("codProduct",
                                new PropertyModel<String>(getDefaultModel(), 
"codProduct")));

                add(new Label("tpVat"));

                add(new AjaxLink<String>("save") {
                        @Override
                        public void onClick(AjaxRequestTarget target) {
                                System.out.println("saving product .... ");
                        }
                });
        }

        public void setCurrentProduct(Product product) {
                setDefaultModel(new CompoundPropertyModel<Product>(product));
        }
}

And here's the code for the item to update the 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(product.getId());
                                        }
                                };
                                item.add(link);


The problem with this code, is the Editable Label doesn't update with
the rest of the labels. I mean if I click on an item, it shows me the
results for the corresponding product in the Labels, but not in the
AjaxEditableLabel.



On Thu, Jul 15, 2010 at 3:48 PM, Martin Makundi
<martin.maku...@koodaripalvelut.com> wrote:
> you need to add the updated panel into target:
>
> target.addComponent(panelToBeUpdated);
>
>
>
> 2010/7/15 Mansour Al Akeel <mansour.alak...@gmail.com>:
>> I just tried it. It doesn't update the panel. Here's the full code:
>>
>> public class ProductDetails extends Panel {
>>
>>       �...@ejb
>>        private ProductServicesLocal productServices;
>>
>>        public ProductDetails(String id, final Product product) {
>>                super(id);
>>                setOutputMarkupId(true);
>>                this.setCurrentProduct(product);
>>                add(new Label("id"));
>>
>>                add(new AjaxEditableLabel<String>("codProduct",
>>                                new 
>> PropertyModel<String>((Product)getDefaultModelObject(), "codProduct")));
>>
>>                add(new AjaxLink<String>("save") {
>>                       �...@override
>>                        public void onClick(AjaxRequestTarget target) {
>>                                System.out.println("saving product .... ");
>>                        }
>>                });
>>        }
>>
>>        public void setCurrentProduct(Product product) {
>>                setDefaultModel(new CompoundPropertyModel<Product>(product));
>>        }
>> }
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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

Reply via email to