Hi Martin,
Thanks for the explanation. To me is a bit weird behavior because I thought
*Wicket*.*Ajax*.*ajax*({*"u"*:url, e: "click" , *"ep" *: {*'name'*: name,
*'type'*: type}, *"pd"*: *true*});
Meant execute an AJAX call and inform server side about these parameter....
But in reality it mean we are executing the call and at the same time
binding something that will be executed again on window click...
On Fri, May 13, 2016 at 9:45 PM, Martin Grigorov <[email protected]>
wrote:
> HI Ernesto,
>
>
> On Thu, May 12, 2016 at 5:05 PM, Ernesto Reinaldo Barreiro <
> [email protected]> wrote:
>
> > I have a custom component which uses wicket AJAX to call server.
> >
> > *MyNameSpace.*SlimTechnologiesLazyListPanel.filter = *function*(url,
> elem,
> > event) {
> > *var *name = *$*(elem).attr(*"techid"*);
> > *var *type = *$*(elem).attr(*"type"*);
> > *Wicket*.*Ajax*.*ajax*({*"u"*:url, *"ep" *: {*'name'*: name,
> *'type'*:
> > type}, *"pd"*: *true*});
> > };
> >
> > I have accidently discovered that if I replace.
>
> *Wicket*.*Ajax*.*ajax*({*"u"*:url, *"ep" *: {*'name'*: name, *'type'*:
> type
> > }, *"pd"*: *true*});
> >
> > with
> >
> > *Wicket*.*Ajax*.*ajax*({*"u"*:url, e: "click" , *"ep" *: {*'name'*:
> name,
> > *'type'*: type}, *"pd"*: *true*});
> > After this line of code is executed on client then any click you perform
> on
> > the browser window will issue this AJAX call. Is that the expected
> > behaviour?
> >
>
> It is expected.
> To save network traffic all properties have default values.
> For 'c' (component) the default is the JS window object. So you bind
> 'click' event listener on the window.
> For 'e' (event) the default is 'domready'.
> See
>
> https://github.com/apache/wicket/blob/76096b7f95586fd3c83f4208c2cc374153fbf884/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1947
> The rest of the properties are needed after the JS event binding so they
> are initialized lazily at
>
> https://github.com/apache/wicket/blob/76096b7f95586fd3c83f4208c2cc374153fbf884/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L402
> ,
> i.e. after the event is fired.
>
>
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> >
>
--
Regards - Ernesto Reinaldo Barreiro