You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

What ?

Since version 6.0 Wicket uses JQuery as a backing library for its Ajax functionality.

Why ?

The previous implementations of wicket-ajax.js and wicket-event.js were home baked solutions that worked well but also suffered from the differences in the browsers. Often users complained that some functionality doesn't work on particular version of particular browser. That's why the Wicket team chose to use JQuery to deal with browser inconsistencies and leave us to do our business logic.

Design and implementation

The new implementations (wicket-ajax-jquery.js and wicket-event-jquery.js) use JQuery internally but expose Wicket.** API similar to the previous version.

All Java components and behaviors should still use the Wicket.** API. This way if someday we decide to not use JQuery anymore we will have less work to do. Also if a user uses Dojo/YUI/ExtJS/... and prefer to not have JQuery in her application then she will be able to provide wicket-ajax-xyz.js implementation and replace the default one.

Table with renamed methods from the previous version

1.5

6.0

Wicket.fixEvent

Wicket.Event.fix

Wicket.stopEvent

Wicket.Event.stop

Wicket.show

Wicket.DOM.show

Wicket.showIncrementally

Wicket.DOM.showIncrementally

Wicket.hide

Wicket.DOM.hide

Wicket.hideIncrementally

Wicket.DOM.hideIncrementally

Wicket.decode

Wicket.Head.Contributor.decode

Wicket.ajaxGet, wicketAjaxGet

Wicket.Ajax.get

Wicket.ajaxPost, wicketAjaxPost

Wicket.Ajax.post

Wicket.submitForm

Wicket.Ajax.submitForm

Wicket.submitFormById

Wicket.Ajax.submitForm

Wicket.replaceOuterHtml

Wicket.DOM.replace

Wicket.Form.doSerialize

Wicket.Form.serializeForm

Link to jsdoc

TODO

Configuration

To replace any of the JavaScript files the user application may use:

MyApplication#init():

public void init() {
  super.init();

  // this is the reference to JQuery
  getAjaxSettings().setBackingLibraryReference(new JavaScriptResourceReference(....));
  
  // wicket-event.js
  getAjaxSettings().setWicketEventReference(new JavaScriptResourceReference(....));

  // wicket-ajax.js
  getAjaxSettings().setWicketAjaxReference(new JavaScriptResourceReference(....));

}

This way the user application can upgrade/downgrade to new/old version of JQuery or even use YUI as backing library with the respective implementations of wicket-ajax and wicket-event based on YUI.

  • No labels