You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "losdrakanos@gmx.net" <lo...@gmx.net> on 2009/05/22 20:17:16 UTC

AjaxEditableLabel.onSubmit: model object not updated?

When running the code below, the object "MyBusinessObject" does not 
contain the value entered via an AjaxEditableLabel after submit. Any 
ideas on this? I've tried this using Wicket 1.3.6.

MyWebPage.add(
   new RefreshingView("list_objects") {
     @Override
     protected void populateItem(Item item) {
       MyBusinessObject obj = (MyBusinessObject)item.getModelObject();
       item.add(
         new AjaxEditableLabel(
           "attrib1",
           new Model(obj.getAttrib1())
         ) {
           @Override
           protected void onSubmit(AjaxRequestTarget target) {
             super.onSubmit(target);
             MyBusinessObject obj = 
(MyBusinessObject)getParent().getModelObject();

             // obj.getAttrib1() does not contain the changed value
             // getEditor().getValue() contains the changed value
           }
         }
       );
     }

     @Override
     protected Iterator getItemModels() {
       return new 
ModelIteratorAdapter(MyBusinessObjectManager.getObjects().iterator()) {
         @Override
         protected IModel model(Object object) {
           return new CompoundPropertyModel((MyBusinessObject) object);
         }
       };
     }
   }
);


Thanks in advance,
Roman

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