|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IAjaxCallDecorator
Interface used to decorate a wicket generated javascript that performs an ajax callback
The returned scripts are rendered in the HTML as follow:
<a href="javascript:[script]var wcall=wicketAjaxGet('[url]', function() {[onSuccessScript]}, function() {[onFailureScript});" ...>[text of the link]</a>As a result, using double quotes in the script will break the link syntax and make it fail (or fallback in the case of an AjaxFallbackLink). So, if single quotes have to be inserted in strings contained in the scripts, they must be properly escaped to pass through Java and Javascript, for example:
return "alert('It\\'s ok!')";Also note that decorateScript(CharSequence script) should generally append to the script rather than replace it:
return "alert('Before ajax call');" + script;Both following examples will break the link:
return "alert('Before ajax call');"; // missing to append the script return "alert('Before ajax call')" + script; // missing ";"
Field Summary | |
---|---|
static java.lang.String |
WICKET_CALL_RESULT_VAR
Name of javascript variable that will be true if ajax call was made, false otherwise. |
Method Summary | |
---|---|
java.lang.CharSequence |
decorateOnFailureScript(java.lang.CharSequence script)
Decorates the onFailure handler script |
java.lang.CharSequence |
decorateOnSuccessScript(java.lang.CharSequence script)
Decorates the onSuccess handler script |
java.lang.CharSequence |
decorateScript(java.lang.CharSequence script)
Decorates the script that performs the ajax call |
Field Detail |
---|
static final java.lang.String WICKET_CALL_RESULT_VAR
Method Detail |
---|
java.lang.CharSequence decorateScript(java.lang.CharSequence script)
script
-
java.lang.CharSequence decorateOnSuccessScript(java.lang.CharSequence script)
script
-
java.lang.CharSequence decorateOnFailureScript(java.lang.CharSequence script)
script
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |