On Mon, May 27, 2013 at 11:33 PM, Sven Meier <[email protected]> wrote:

> Hi,
>
> you're adding an additional behavior that has nothing to do with the
> behavior created in AjaxLink#newAjaxEventBehavior(**).
>
> SomeAjaxBehavior#**updateAjaxAttributes() and #respond() are never
> invoked.


Correct.

You have to
call org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#getCallbackScript()
manually for non-AjaxEventBehaviors


>
>
> Sven
>
>
>
>
> On 05/27/2013 10:22 PM, stefanofg wrote:
>
>> on the other hand, if I create an AbstractDefaultAjaxBehavior, override
>> updateAjaxAttributes, and attach it to the component, the two handlers are
>> not invoked:
>>
>> public class HomePage extends WebPage {
>>         public HomePage(final PageParameters parameters) {
>>                 super(parameters);
>>
>>
>>
>>                 final AjaxLink<String> link = new
>> AjaxLink<String>("submit",**Model.of("link"))
>>                 {
>>
>>                         @Override
>>                         public void onClick(AjaxRequestTarget target)
>>                         {
>>                         }
>>                 };
>>
>>                 link.add(new SomeAjaxBehavior());
>>
>>                 add(link);
>>
>>      }
>> }
>>
>>
>> // SomeSomeAjaxBehavior
>> public class SomeAjaxBehavior extends AbstractDefaultAjaxBehavior
>> {
>>
>>         @Override
>>         protected void updateAjaxAttributes(**AjaxRequestAttributes
>> attributes)
>>         {
>>                 // TODO Auto-generated method stub
>>                 super.updateAjaxAttributes(**attributes);
>>                  IAjaxCallListener listener = new IAjaxCallListener()
>>               {
>>
>>                         @Override
>>                         public CharSequence getBeforeHandler(Component
>> component)
>>                         {
>>                                 return "alert('Before');";
>>                         }
>>
>>                         ...
>>
>>                         @Override
>>                         public CharSequence getCompleteHandler(Component
>> component)
>>                         {
>>                                 return "alert('Complete');";
>>                         }
>>
>>               };
>>
>>               attributes.**getAjaxCallListeners().add(**listener);
>>         }
>>
>>         @Override
>>         protected void respond(AjaxRequestTarget target)
>>         {
>>
>>         }
>>
>> }
>>
>> am I missing something or this is a bug?
>>
>> Thanks
>>
>>
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.**
>> n4.nabble.com/**IAjaxCallListener-issues-in-**
>> AbstractDefaultAjaxBehavior-**updateAjaxAttributes-**tp4659055.html<http://apache-wicket.1842946.n4.nabble.com/IAjaxCallListener-issues-in-AbstractDefaultAjaxBehavior-updateAjaxAttributes-tp4659055.html>
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org<[email protected]>
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org<[email protected]>
> For additional commands, e-mail: [email protected]
>
>

Reply via email to