hi

you can try in this way setting item.getModelObject() as final
final StandardTekst st = item.getModelObject();
and in the sva button you have to save the ListTekst



final ListView list = new ListView("stListing", ListTekst) {
@Override
protected void populateItem(final ListItem<StandardTekst> item) {

TextClass st = new TextClass();

+++final StandardTekst st = item.getModelObject();
---st = item.getModelObject();

final TextArea  tekst  = new TextArea ("stTekst",new PropertyModel(st,
"tekst"));
tekst.add(new OnChangeAjaxBehavior() {
 @Override
 protected void onUpdate(AjaxRequestTarget target) {
   String editedText = (String) tekst.getModelObject();
    st.setTekst(editedText);
   }

2010/7/20 lucky <rlaczek1...@gmail.com>

>
> Hi Colleagues,
>
> I have listView where in TextArea I have used onChangeAjaxBehavior.
> In update() I set edited text to the object.
> Finally in saveButton (this button is required) via savingMethod() I add
> changes to database and then refresh form.
> The problem is that when text is edited in given row (item) at the ListView
> after refresh action the edited text is assigned to the last item at the
> list.
> I know that probably I must use in any way id but I don’t know exactly how
> to do it.
> Generally saying in my application I must have one saveButton that will be
> common for all items at the list.
> This button is also used to save new added item via separate text field in
> the form. This works fine.
> Can you suggest please solution. This is very urgent for me.
> Please also eventually suggest solution without OnChangeAjaxBehavior.
> Below is my code.
>
>
>
> Regards,
> Rafal
>
>
>
> ……
> saveButton.add(new AjaxFormComponentUpdatingBehavior("onclick"){
> protected void onUpdate(AjaxRequestTarget target) {
> object.savingMethod(st);  //Saving changes to database
> target.addComponent(form);
> }
> form.add(saveButton);
>
> …..
>
> final ListView list = new ListView("stListing", ListTekst) {
> @Override
> protected void populateItem(final ListItem<StandardTekst> item) {
>
> TextClass st = new TextClass();
> st = item.getModelObject();
>
> final TextArea  tekst  = new TextArea ("stTekst",new PropertyModel(st,
> "tekst"));
> tekst.add(new OnChangeAjaxBehavior() {
>  @Override
>  protected void onUpdate(AjaxRequestTarget target) {
>    String editedText = (String) tekst.getModelObject();
>    st.setTekst(editedText);
>        }
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/OnChangeAjaxBehavior-problem-with-id-tp2296313p2296313.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