简体   繁体   English

使用具有通过小门1.4退出时更新模型的功能在listView中添加TextField

[英]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. 我正在尝试在listView中添加TextField,以便可以在退出时或在更新文本后更新模型。

I have received a wonderful solution for this listed bellow but it seems works in wicket 6.7.0, I guess? 对于此列出的波纹管,我已经收到了一个很好的解决方案,但似乎可以在6.7.0小门上使用。

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? 但是我需要使用wicket 1.4,所以上面针对wicket 1.4的代码有类似的实现或解决方案?

Thanks for someone that could help me. 谢谢能帮助我的人。

There is no updateAjaxAttributes method in 1.4 call method setThrottleDelay on the behaviour instead. 在行为上,在1.4调用方法setThrottleDelay没有updateAjaxAttributes方法。 See docs for the details. 有关详细信息, 请参阅文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM