Thank you both for your feedback, everything is in place now.
For the record, the code that generates the required javascript now is:
"$('#" + markupId + "').on('blur', '.df', function() {var comp =
$(this).attr('name'); var cid=$(this).attr('id'); var data = {};
data['component']=comp; Wicket.Ajax.post({'u':'" + callbackUrl + "',
'e':'blur', 'c':cid, 'ep': data});});
Passing the component id to Wicket.Ajax.post automatically adds its current
value to the post parameters. So I only had to use 'ep' to pass the
component's name so that AbstractDefaultAjaxBehavior#respond() can know
which component to update.
On Tue, Oct 8, 2013 at 10:49 PM, Ernesto Reinaldo Barreiro <
[email protected]> wrote:
> This link might be useful too
>
> https://github.com/reiern70/antilia-bits/tree/master/wicket-sparelinks
>
>
>
>
> On Tue, Oct 8, 2013 at 9:31 PM, Marios Skounakis <[email protected]> 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
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>