在提交Wicket&ŧ039;s AjaxButton的脚本之前

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在提交Wicket&ŧ039;s AjaxButton的脚本之前相关的知识,希望对你有一定的参考价值。

  1. new AjaxButton("save") {
  2. @Override
  3. protected IAjaxCallDecorator getAjaxCallDecorator() {
  4. return new DisableComponentCallDecorator(super.getAjaxCallDecorator(), this);
  5. }
  6. }
  7.  
  8. class DisableComponentCallDecorator extends AjaxPreprocessingCallDecorator {
  9. private final String selector;
  10. private DisableComponentCallDecorator(IAjaxCallDecorator delegate, String jquerySelector) {
  11. super(delegate);
  12. this.selector = jquerySelector;
  13. }
  14. private DisableComponentCallDecorator(IAjaxCallDecorator delegate, Component component) {
  15. super(delegate);
  16. component.setOutputMarkupId(true);
  17. this.selector = "#" + component.getMarkupId();
  18. }
  19. @Override
  20. public CharSequence preDecorateScript(CharSequence script) {
  21. return "$('" + selector + "').addClass('disabled_while_waiting').attr('disabled','disabled'); " + super.preDecorateScript(script);
  22. }
  23. @Override
  24. public CharSequence preDecorateOnSuccessScript(CharSequence script) {
  25. return "$('" + selector + "').removeAttr('disabled'); " + super.preDecorateOnSuccessScript(script);
  26. }
  27. @Override
  28. public CharSequence preDecorateOnFailureScript(CharSequence script) {
  29. return "$('" + selector + "').removeAttr('disabled'); " + super.preDecorateOnFailureScript(script);
  30. }
  31. }

以上是关于在提交Wicket&ŧ039;s AjaxButton的脚本之前的主要内容,如果未能解决你的问题,请参考以下文章

使用TextMate&ŧ039;s tmŧdialog命令显示警报框

在数字中的K&ŧ039;s之间添加空格

使用两个表的并集获取Count&ŧ039;s

启动时加载部分CUI&ŧ039;s

使用loadClip加载图像/Swf&ŧ039;s

Clojure中的Dijkstra&ŧ039;s算法