Hi Paul, thanks very much for your help!

I followed your suggestion but this peace of code doesn't compile
unfortunately:

IModel descriptionModel = new PropertyModel[Meeting](meeting,
"description"));

I have tried

val descriptionModel[IModel] = new PropertyModel[Meeting](meeting,
"description")); //wrong systax for scala

and

val descriptionModel = new IModel[Meeting](meeting, "description")); //
IModel can't be instanced

But I'm doing this thing wrong.

I made a great progress with my app but now I'm struggling with this issue
and I spent a lot
of time to archive this simple task. If I'm  doing this stuff with java my
life could
be much easier :-D.

I'll appreciate your hep again


Thanks very much




Bera


2013/5/10 Paul Bors <p...@bors.ws>

> Why the Ajax round-trips for each "keyup" to extract the model's object?
> Have you tried to implement just the Save link/button and then look-up the
> model object from inside the onClick() method?
>
> In your case it would come from the PropertyModel you use already:
>
> TextField description = new TextField("description",new
> PropertyModel[Meeting](meeting, "description"))
>
> change to:
>
> IModel descriptionModel = new
> PropertyModel[Meeting](meeting, "description"));
> TextField descriptionTextField = new TextField("description",
> descriptionModel );
>
> and your link becomes:
>
> private class LinkSave(id: String, meeting: Meeting) extends
> AjaxLink[String](id) {
>
> @SpringBean
> var meetingMediator: TMeetingMediator = _
>   def onClick(target: AjaxRequestTarget) {
>     meetingDAO.saveMeeting(descriptionModel.getObject())
>   }
> }
>
> Unless you want to also update some other element on the screen with each
> user key press I really don't think you need the "keyup" listener.
>
> ~ Thank you,
>    Paul Bors
>
>
> On Thu, May 9, 2013 at 11:03 PM, Bruno Moura <brunormo...@gmail.com>
> wrote:
>
> > I'm trying to implement a ListView and in on column of it I added a
> > listView, for each line,
> > I want to save the data inserted on it and update the model:
> >
> > I'm implemented the code bellow:
> >
> > val description = new TextField("description",new
> > PropertyModel[Meeting](meeting, "description"))
> > description.add(new AjaxFormComponentUpdatingBehavior("keyup") {
> >   protected def onUpdate(target: AjaxRequestTarget) {
> >     description.getDefaultModelObjectAsString
> >   }
> > })
> >
> > item.add(description)
> >
> > And I added a link for each line of my ListView for save the information
> in
> > database,
> > each line is a instance of a model meeting as is showed bellow:
> >
> > item.add(new LinkSave("save", meeting))
> >
> > private class LinkSave(id: String, meeting: Meeting) extends
> > AjaxLink[String](id) {
> >
> >     @SpringBean
> >     var meetingMediator: TMeetingMediator = _
> >
> >     setVisible(clickavel.asInstanceOf[Boolean])
> >     add(new Label("label", new Model[String]() {
> >       override def getObject: String = "Save"
> >     }))
> >
> >     def onClick(target: AjaxRequestTarget) {
> >       meetingDAO.saveMeeting(meeting)
> >
> >     }
> >   }
> >
> >
> > But unfortunately the code above doesn't work. It's fail to retrieve the
> > value of the text
> > field and also to set the attribute description of the Object meeting
> with
> > the value of the text field, so in the database the column description is
> > never filled
> >
> > Someone know where I am doing wrong stuff?
> >
> > Thanks a lot!
> >
> >
> > Bera
> >
>

Reply via email to