...
Code Block |
---|
public void init() {
super.init();
IJavaScriptLibrarySettings jsSettings = getJavaScriptLibrarySettings();
jsSettings.setJQueryReference(new MyJQueryReference());
jsSettings.setWicketEventReference(new DojoWicketEventReference());
jsSettings.setWicketAjaxReference(new DojoWicketAjaxReference());
}
|
...
Code Block |
---|
Wicket.Ajax.get({"u":"the/url/to/the/link", "e": "click", "c":"linkId"}); |
...
Many of the attributes have default values which are not written in the JSON settings and they are initialized at the client side (i.e. wicket-ajax.js knows the defaults). The example above can be read as: when HTML element with id 'linkId' is clicked fire an Ajax call with Url 'the/url/to/the/link'.
If you need more examples how to use it from JS, take a look at wicket sources: wicket-core/src/test/js/ajax.js
Migration steps
o.a.w.ajax.IAjaxCallDecorator is replaced with o.a.w.ajax.attributes.IAjaxCallListener.
...
An introduction to the new functionalities are described at Wicket In Action. There is also a link to a demo application.
FAQ
Anchor | ||||
---|---|---|---|---|
|
How to check whether my custom version of the backing JavaScript library (jQuery) doesn't break Wicket internals somehow ?
- Clone Wicket from its Git repository
git clone http://git-wip-us.apache.org/repos/asf/wicket.git - Open wicket-core/src/test/js/all.html and change it to point to your version of the backing library.
- Run the non-Ajax tests by opening file:///path/to/wicket/wicket-core/src/test/js/all.html
- To run the Ajax tests see the description at the top of wicket-core/src/test/js/ajax.js. It is required to run them through Web Server
...