Wicket
  1. Wicket
  2. WICKET-4096

AjaxIndicatorAppender.renderHead does not pass Components id in its call of renderJavaScript

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.0
    • Fix Version/s: 1.5.2
    • Component/s: wicket-extensions
    • Labels:
    • Environment:
      Windows 32bit XP, Tomcat 7, java6 and scala 2.9.1, build with Eclipse

      Description

      In an AjaxEditalbeLabel we set an int - that will reload a dataview with number of lines as given in the AjaxEditingLabel.
      In that dataview we use IndicatingAjaxLink to sort the columns. With Wicket 1.4.18 that worked well.

      With Wicket 1.5.0 in this scenario, if the AjaxEditalbeLabels onSubmit(...) Method is called, an error occurred:
      Root cause:

      java.lang.IllegalArgumentException: Argument 'id' may not be null.
      at org.apache.wicket.util.lang.Args.notNull(Args.java:39)
      at org.odlabs.wiquery.core.AbstractWiQueryDecoratingHeaderResponse.renderJavaScript(AbstractWiQueryDecoratingHeaderResponse.java:128)
      at org.apache.wicket.extensions.ajax.markup.html.AjaxIndicatorAppender.renderHead(AjaxIndicatorAppender.java:71)
      at org.apache.wicket.Component.renderHead(Component.java:2662)
      at org.apache.wicket.ajax.AjaxRequestTarget$3.component(AjaxRequestTarget.java:1256)
      ...

      We found that the AjaxIndicatorAppender.renderHead calls the org.odlabs.wiquery.core.AbstractWiQueryDecoratingHeaderResponse.renderJavaScript(someJavaScript, null)
      The method renderJavaScript expicitly checks if the second parameter is null and throws an Error here.

      Imho the AjaxIndicatorAppender.renderHead should pass the components id instead of the null.

      By the way: Wicket rocks anyway, but 1.5 is another Highlight!
      Thanks a lot and best Regards,
      Marcus Bosten

        Activity

        Hide
        Martin Grigorov added a comment -

        This seems to be WiQuery problem, not Wicket one.

        Show
        Martin Grigorov added a comment - This seems to be WiQuery problem, not Wicket one.
        Hide
        Marcus Bosten added a comment -

        mmmm - I am not sure, because

        @Override
        public void renderHead(final Component component, final IHeaderResponse response) {
        if (AjaxRequestTarget.get() != null)

        { final String javascript = "var e = Wicket.$('" + getMarkupId() + "'); if (e != null && typeof(e.parentNode) != 'undefined') e.parentNode.removeChild(e);"; response.renderJavaScript(javascript, null); }

        }

        does not use the component at all (only the class field component is used in getMarupId() - why to pass it?
        And how should any following method get any info of the components MarkupID - so that it can react on it?

        Show
        Marcus Bosten added a comment - mmmm - I am not sure, because @Override public void renderHead(final Component component, final IHeaderResponse response) { if (AjaxRequestTarget.get() != null) { final String javascript = "var e = Wicket.$('" + getMarkupId() + "'); if (e != null && typeof(e.parentNode) != 'undefined') e.parentNode.removeChild(e);"; response.renderJavaScript(javascript, null); } } does not use the component at all (only the class field component is used in getMarupId() - why to pass it? And how should any following method get any info of the components MarkupID - so that it can react on it?
        Hide
        Martin Grigorov added a comment -

        Sorry. I had modified version of this file locally.

        Show
        Martin Grigorov added a comment - Sorry. I had modified version of this file locally.
        Hide
        Igor Vaynberg added a comment -

        that shouldve been renderOnDomReadyJavaScript() instead of renderJavaScript() so i changed it.

        however, null ids are allowed so wiquery is also at fault here.

        Show
        Igor Vaynberg added a comment - that shouldve been renderOnDomReadyJavaScript() instead of renderJavaScript() so i changed it. however, null ids are allowed so wiquery is also at fault here.
        Hide
        Marcus Bosten added a comment -

        You guyes are implressively fast.
        I will pass the info to the Wiquery team

        Thank you,
        Marcus

        Show
        Marcus Bosten added a comment - You guyes are implressively fast. I will pass the info to the Wiquery team Thank you, Marcus

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            Marcus Bosten
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development