Hi,

I use the javascript generated by getCallbackFunction just fine. Here's an actual function used as an onclick callback:

function (event) {
var attrs = {"u":"./103?1-1.IBehaviorListener.0-","i":"veil"};
var params = {'tourAction': "1"};
attrs.ep = params;
Wicket.Ajax.ajax(attrs);
}

The java code that generated it is :
        // Collect the extra parameters
        CallbackParameter[] parameters = new CallbackParameter[2];
        parameters[0] = CallbackParameter.context("event");
        parameters[1] = CallbackParameter.resolved("tourAction", "1");

        // Generate callback function
        CharSequence callbackFunction = getCallbackFunction(parameters);

This definitely does an ajax call. I haven't looked closely at the Wicket.Ajax.ajax() code, but it works fine.

Bertrand

On 19/07/2013 9:58 AM, Frank van Lankvelt wrote:
hi all,

in the process of upgrading to wicket 6, I have to do some wicket ajax
calls from custom javascript callbacks.  The AbstractDefaultAjaxBehavior
seems to provide a bunch of tools to help me out.  But I cannot make sense
of the javadoc (& implementation) of #getCallbackFunction:

  * Generates a javascript function that can take parameters and performs an
AJAX call which
  * includes these parameters. The generated code looks like this:
  *
  * <pre>
  * function(param1, param2) {
  *    var attrs = attrsJson;
  *    var params = {'param1': param1, 'param2': param2};
  *    attrs.ep = jQuery.extend(attrs.ep, params);
  *    Wicket.Ajax.ajax(attrs);
  * }
  * </pre>

But AFAIK the last line of the generated function Wicket.Ajax.ajax(attrs)
does not do an ajax call.
It just uses jQuery to register event listeners.

So have I missed something, or is this a bug?

thanks, Frank



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to