Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

I'm in process of rewriting the Ajax support for 1. 5. The current (very experimental) code is available at http://svn.apache.org/repos/asf/wicket/sandbox/knopp/experimentalImage Removed in package org.apache.wicket.ajaxng (will be later renamed to ajax replacing current ajax classes).

...

  • Should be much more stable and solid than current implementation. It supports timeout for the Ajax request and timeout for the processing afterwards. The new ajax pipeline should never hang with "chanel busy. postponing" like to current one can.
  • Much smaller impact on generated markup file. Current ajax generates markup such as
    Code Block
     
    onclick="var wcall=wicketAjaxGet('../?wicket:interface=:2:c1::IBehaviorListener:1:1',null,null, function() {return Wicket.$('c12') != null;}.bind(this));
    
    while for the same effect new Ajax implementation only generates
    Code Block
    W.e('click',{c:"c12",b:0});
    
  • The call is no longer part of actual element, rather than that it's executed as onDomReady javascript
  • Adding custom before/after handlers, preconditions and parameters no longer needs ugly string concatenations
  • Improved throttling
  • TextField/TextArea selection and cursor position is preserved when the element is refreshed with Ajax
  • AjaxRequestTarget allows to register javascript executed right before and right after component replacement. The javascript is asynchronous and the rest of the pipeline waits until the javascript calls the notify method (can be used for animations). Also the actual replacement call can be customized.
  • AjaxRequestTarget also allows prepend and append javascripts to be asynchronous.

Usage of new API

AjaxRequestAttributes defines possible configuration options for AjaxRequest.

...

Code Block
  add(new AjaxLink("link") 
  {
    protected void updateAttributes(AjaxRequestAttributes attributes)
    {
      super.updateAttributes(attributes);

      attributes.getUrlArguments().put("param1", "value1");
    }
    
    public void onClick(AjaxRequestTarget target)
    {
      ...
    }
  }

...