Search code examples
scalawicketwicket-1.4

Add TextField in a listView with the feature to update the model on exit using wicket 1.4


I'm trying to add TextField in a listView that can update a model on exit or after update the text on it.

I have received a wonderful solution for this listed bellow but it seems works in wicket 6.7.0, I guess?

import org.apache.wicket.ajax.attributes.{ThrottlingSettings, AjaxRequestAttributes}


 val detail = new TextField("detail", new PropertyModel[Meeting](meeting, "description"))
      detail.add(new AjaxFormComponentUpdatingBehavior(("keyup")) {
        protected def onUpdate(target: AjaxRequestTarget) {
          meeting.salvarMeetingInfo(meeting)
        }

        protected override def updateAjaxAttributes(attributes: AjaxRequestAttributes) {
          attributes.setThrottlingSettings(new ThrottlingSettings("thr", Duration.milliseconds(800.0)))
          super.updateAjaxAttributes(attributes)
        }
})
item.add(detail)

//Error messages
      scala: object attributes is not a member of package org.apache.wicket.ajax
import org.apache.wicket.ajax.attributes.{ThrottlingSettings, AjaxRequestAttributes}

                              ^

scala: not found: type AjaxRequestAttributes
        protected override def updateAjaxAttributes(attributes: AjaxRequestAttributes) {
                                                            ^

But I need to use wicket 1.4, so there is an similar implementation or solution of the code above for wicket 1.4?

Thanks for someone that could help me.


Solution

  • There is no updateAjaxAttributes method in 1.4 call method setThrottleDelay on the behaviour instead. See docs for the details.