Hi,
take a look at AjaxFormChoiceComponentUpdatingBehavior on how to add
dynamic parameters to Wicket's ajax calls. Read
https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax#WicketAjax-AjaxRequestAttributes
too.
Sven
On 10/08/2013 09:31 PM, Marios Skounakis wrote:
Hi all,
I want to implement an ajax behavior similar to
AjaxFormComponentUpdatingBehavior but which can be attached only once to a
parent container component and issue ajax calls for all contained form
components.
So what I did was extend AbstractDefaultAjaxBehavior and pretty much copy
the logic of AjaxFormComponentUpdatingBehavior respond() except that the
component is located via the request parameters.
This worked quite ok.
I had a lot of trouble with emitting the appropriate javascript. The
behavior by default attaches to the container component and does not post
anything useful. So I had to resort to adding custom javascript in
renderHead().
I ended up manually constructing a variable with the post parameters and
using jQuery post() to send them to the behavior's callback url.
response.render(OnDomReadyHeaderItem
.forScript("$('#" + markupId + "').on('blur', '.df',
function() {var comp = $(this).attr('name'); var data = {}; data[comp] =
$(this).val(); data['component']=comp; data['"
+ WebRequest.PARAM_AJAX
+ "']=true; data['"
+ WebRequest.PARAM_AJAX_BASE_URL
+ "']=Wicket.Ajax.baseUrl; $.post('"
+ getCallbackUrl() + "', data);" + "});"));
}
I wanted to use Wicket.Ajax calls to achieve the same effect but failed
miserably in all attempts to use Wicket.Ajax.ajax() or Wicket.Ajax.post().
It is my understanding that these register event handlers rather than issue
direct calls.
So, how does one use the Wicket.Ajax library to issue an ajax call with
custom post parameters? Is there some documentation I am not aware of?
Thanks
Marios
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]