Yeah Eugene,

f.setModelObject(e) works too and its even better i thinks :)

Thanks!


Eugene Malan wrote:
> 
> I think you might have to use setVisibilityAllowed(true), otherwise  
> the html does not make it onto the page.
> Maybe this is better...
> 
>       f = new EditForm<Functionsbereich>("form",new  
> CompoundPropertyModel<Functionsbereich>(el));
>       f.setVisible(false);
>       f.setVisibilityAllowed(true);
> 
> and then for Ajax...
> 
>      f.setModelObject(e);
> 
> On 16 Dec 2009, at 7:09 AM, Eugene Malan wrote:
> 
>> Try replacing the Model's object instead of the actual Model.
>>
>>      private EditFormModel editFormModel = new  
>> CompoundPropertyModel<Functionsbereich>(el);
>>
>>      replace
>>      //f.setModel(new CompoundPropertyModel<Functionsbereich>(el));
>>      editFormModel.setObject(el);
>>
>>
>> On 16 Dec 2009, at 6:27 AM, Martin U wrote:
>>
>>> Iam totally confused.
>>>
>>> Iam using the Todo-List-Example from here :
>>> http://www.wicket-library.com/wicket-examples/ajax/todo-list.0
>>> to play around with wicket.
>>>
>>> This example works, but i want to display a list of Entities from the
>>> Backend and edit one of them with my "new-entity"-Form.
>>> So i want to click on "edit" in a row and want to use the *same*  
>>> *form *as i
>>> use to add a entity. How could i handle this?
>>>
>>> I tried sooo much but nothing works right.
>>>
>>>
>>> The "addForm" (showForm(target)) function works right. But in  
>>> public void
>>> showForm(AjaxRequestTarget _t, Functionsbereich el)
>>> i deliver "el" which is my POJO and i cant figure out how to treat  
>>> the Form
>>> to use now my new "Model"...
>>> I tried with modelChange() und mondelChanging() but nothing works  
>>> =( allways
>>> the "empty Form" is shown ;(
>>>
>>> Thanks a lot for any help!!
>>>
>>>   private final class FormContainer extends WebMarkupContainer{
>>>
>>>       private EditForm f;
>>>
>>>       public FormContainer(String id) {
>>>           super(id);
>>>           setOutputMarkupId(true);
>>>
>>>
>>>           add(f = (EditForm) new EditForm("form").setVisible(false));
>>>           add(new AjaxFallbackLink("link"){
>>>
>>>               @Override
>>>               public void onClick(AjaxRequestTarget target) {
>>>                   showForm(target);
>>>               }
>>>
>>>           });
>>>       }
>>>
>>>       public void showForm(AjaxRequestTarget _t){
>>>           f.setVisible(true);
>>>           _t.addComponent(this);
>>>
>>>       }
>>>
>>>       /** Shows form with entity **/
>>>       public void showForm(AjaxRequestTarget _t, Functionsbereich  
>>> el){
>>> //            add(f = new EditForm("link", el));
>>>           f.modelChanging();
>>>           f.setModel(new  
>>> CompoundPropertyModel<Functionsbereich>(el));
>>>
>>>
>>>           f.modelChanged();
>>>           f.setVisible(true);
>>>
>>>           _t.addComponent(this);
>>>
>>>       }
>>>
>>>
>>>   }
>>>
>>>   private final class EditForm extends Form<Functionsbereich>{
>>>
>>>       public EditForm(String id){
>>>           this(id, new CompoundPropertyModel<Functionsbereich>(new
>>> Functionsbereich()));
>>>       }
>>>
>>>       public EditForm(String id, Functionsbereich _el){
>>>           super(id,new  
>>> CompoundPropertyModel<Functionsbereich>(_el) );
>>>       }
>>>
>>>       public EditForm(String id,  
>>> CompoundPropertyModel<Functionsbereich>
>>> _model) {
>>>           super(id, _model);
>>>
>>>
>>>           setOutputMarkupId(true);
>>>           add( new TextField("form_text",  
>>> _model.bind("label")));
>>>
>>>           //add(new Label("vendor", _model.bind("vendor.name")));
>>>
>>>
>>>       }
>>>
>>>   }
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Updating-Form-Elements-by-Ajax-with-new-POJO-Model-tp26810357p26811726.html
Sent from the Wicket - User 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

Reply via email to