Scratch that, the solution below causes a page refresh... getAjaxCallDecorator() returns new CancelEventIfNoAjaxDecorator() it works fine, but if it returns the defined decorator, the page refreshes after the ajax call is complete. Why would that be? Should decorator extend CancelEventIfNoAjaxDecorator??
Tremelune wrote: > > 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()); > } > } > -- View this message in context: http://www.nabble.com/Adding-more-onclick-script-to-ajax-link--tf3843103.html#a10901080 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 Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user