Well, that works...I think this would be made easier if there were a
getAjaxBehavior() method in AjaxPagingNavigationIncrementLink. As it stands,
there are a few methods in my class that were copied/pasted directly from
AjaxPagingNavigationLink:
public class DecoratableAjaxPagingNavigationIncrementLink extends
PagingNavigationIncrementLink
implements IAjaxLink {
public DecoratableAjaxPagingNavigationIncrementLink(final String id, final
IPageable pageable,
final int increment) {
super(id, pageable, increment);
//Adds more text to onclick attribute
final AjaxCallDecorator decorator = new AjaxCallDecorator() {
public CharSequence decorateScript(final CharSequence charSequence) {
CharSequence ajaxCall = super.decorateScript(charSequence);
return ajaxCall + "more onclick stuff";
}
};
//Adds onclick attribute
final AjaxPagingNavigationBehavior behavior =
new AjaxPagingNavigationBehavior(this, pageable, "onclick") {
protected IAjaxCallDecorator getAjaxCallDecorator() {
return decorator;
}
};
//The rest of this class is direct from AjaxPagingNavigatorLink
add(behavior);
setOutputMarkupId(true);
}
protected String getEventHandler(String defaultHandler) {
return defaultHandler;
}
public void onClick() {
onClick(null);
setRedirect(false);
setResponsePage(getPage());
}
public void onClick(AjaxRequestTarget target) {
pageable.setCurrentPage(getPageNumber());
}
}
James McLaughlin-3 wrote:
>
> Yeah, I see what you mean. The AjaxPagingNavigationIncrementLink is
> not really an AjaxLink, but has had an AjaxBehavior grafted in. I
> think your best bet would be to build a PagingNavigationIncrementLink
> and add a behavior similar to AjaxPagingNavigationBehavior to it, but
> with the scriptaculous stuff added in as well.
>
> hth,
> jim
>
On 5/31/07, Tremelune <[EMAIL PROTECTED]> wrote:
>
> I misspoke a earlier, the method I need to override is
> newPagingNavigationIncrementLink(). Looks like this:
>
> public AjaxPagingNavigationIncrementLink(final String id, final
> IPageable
> pageable, final int increment)
> {
> super(id, pageable, increment);
> add(new AjaxPagingNavigationBehavior(this, pageable,
> "onclick"));
>
> setOutputMarkupId(true);
> }
>
> Because the behavior is plugged into the constructor, there isn't anything
> I
> can override to change that, unless I duplicate the code in this
> constructor
> elsewhere. I may try using mouseup or onblur or something...My end goal is
> to use Scriptaculous to fade from one page to the next.
--
View this message in context:
http://www.nabble.com/Adding-more-onclick-script-to-ajax-link--tf3843103.html#a10899846
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user