Wicket
  1. Wicket
  2. WICKET-4862

AjaxPagingNavigationLink and AjaxPagingNavigationIncrementLink output inline onclick attributes in addition to Wicket.Ajax.ajax event registration

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.2.0
    • Fix Version/s: 6.12.0, 7.0.0-M1
    • Component/s: wicket
    • Environment:
      Not env specific

      Description

      The AjaxPagingNavigation links are outputting inline onclick attributes in addition to being registered via Wicket.Ajax.ajax calls when used with certain tags like span. These are Ajax components so therefore should no longer have inline onclick handlers.

      1. WICKET-4862.patch
        3 kB
        Martin Grigorov
      2. awqs.zip
        29 kB
        Barrett Snyder

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        5d 4h 17m 1 Martin Grigorov 15/Nov/12 08:51
        Resolved Resolved Reopened Reopened
        23h 29m 1 Martin Grigorov 16/Nov/12 08:21
        Reopened Reopened Resolved Resolved
        319d 3h 26m 1 Martin Grigorov 01/Oct/13 12:47
        Martin Grigorov made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Fix Version/s 7.0.0 [ 12322958 ]
        Fix Version/s 6.12.0 [ 12324889 ]
        Resolution Fixed [ 1 ]
        Hide
        Martin Grigorov added a comment -

        Dries Schulten Your approach looks good to me. Applied!

        Show
        Martin Grigorov added a comment - Dries Schulten Your approach looks good to me. Applied!
        Martin Grigorov made changes -
        Assignee Martin Grigorov [ mgrigorov ]
        Hide
        Dries Schulten added a comment -

        Seeing the same issue using Wicket 6.10.0, we use 'em' tags for our paging. Wicket renders an onclick attribute on the 'em' tag because the AjaxPagingNavigationLink extends from Link which in onComponentTag renders a onclick if the tag is not a 'a' tag. Because the Ajax paging links use a AjaxPagingNavigationBehavior that renders a JavaScript click event the original click is not needed (only for non ajax fallback?). Our current workaround is to remove the generated onclick handler in the onComponentTag of AjaxPagingNavigtionLink but I think it stops ajax fallback from working (our whole application is ajax based so no issue for us).

        protected void onComponentTag(ComponentTag tag) {
        	super.onComponentTag(tag);
        	tag.remove("onclick");
        }
        
        Show
        Dries Schulten added a comment - Seeing the same issue using Wicket 6.10.0, we use 'em' tags for our paging. Wicket renders an onclick attribute on the 'em' tag because the AjaxPagingNavigationLink extends from Link which in onComponentTag renders a onclick if the tag is not a 'a' tag. Because the Ajax paging links use a AjaxPagingNavigationBehavior that renders a JavaScript click event the original click is not needed (only for non ajax fallback?). Our current workaround is to remove the generated onclick handler in the onComponentTag of AjaxPagingNavigtionLink but I think it stops ajax fallback from working (our whole application is ajax based so no issue for us). protected void onComponentTag(ComponentTag tag) { super .onComponentTag(tag); tag.remove( "onclick" ); }
        Martin Grigorov made changes -
        Attachment WICKET-4862.patch [ 12555354 ]
        Hide
        Martin Grigorov added a comment -

        @Wicket devs: is this solution too ugly for this problem ?

        The Ajax navigation links extend from Link (instead from AjaxLink due to limitations in Java language) and this causes the logic in org.apache.wicket.markup.html.link.Link#onComponentTag() around line 403 to trigger.
        With the suggested hack this is avoided.

        Show
        Martin Grigorov added a comment - @Wicket devs: is this solution too ugly for this problem ? The Ajax navigation links extend from Link (instead from AjaxLink due to limitations in Java language) and this causes the logic in org.apache.wicket.markup.html.link.Link#onComponentTag() around line 403 to trigger. With the suggested hack this is avoided.
        Martin Grigorov made changes -
        Resolution Cannot Reproduce [ 5 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Martin Grigorov added a comment -

        Thanks for the quickstart!

        Show
        Martin Grigorov added a comment - Thanks for the quickstart!
        Barrett Snyder made changes -
        Attachment awqs.zip [ 12553677 ]
        Hide
        Barrett Snyder added a comment -

        Here is the quickstart. The key to reproducing is using tags other than anchor tags for the navigation links, in this case spans. Just view the source of the page and you'll see the nav links get AJAX behavior click registration in addition to inline onclick handlers. Clicking the paging nav fires 2 requests, one for the AJAX behavior and 1 for the inline onclick.

        Show
        Barrett Snyder added a comment - Here is the quickstart. The key to reproducing is using tags other than anchor tags for the navigation links, in this case spans. Just view the source of the page and you'll see the nav links get AJAX behavior click registration in addition to inline onclick handlers. Clicking the paging nav fires 2 requests, one for the AJAX behavior and 1 for the inline onclick.
        Martin Grigorov made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Cannot Reproduce [ 5 ]
        Hide
        Martin Grigorov added a comment -

        Please provide a quickstart demonstrating the problem.

        Show
        Martin Grigorov added a comment - Please provide a quickstart demonstrating the problem.
        Barrett Snyder created issue -

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Barrett Snyder
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development