Martin,

ok, I will think about going to one of the ideas Thomas suggested. I still like 
the
idea that I have my javascript only in the markup file and nothing in the Java 
class,
though...

Thanks again,

J.


On 04.06.2012 21:25, Martin Grigorov wrote:
On Mon, Jun 4, 2012 at 10:22 PM, Jürgen Lind<juergen.l...@iteratec.de>  wrote:
Thanks Martin,

maybe I should have asked before trying to invent my own stuff... Anyway,
developing
a new wicket tag was some kind of fun as well...

I'm glad you have fun but I highly recommend staying away from
IComponentResolver if you can afford that.
Many of the unresolved tickets in Wicket's Jira are related to this.


J.


On 04.06.2012 21:10, Martin Grigorov wrote:

On Mon, Jun 4, 2012 at 10:01 PM, Jürgen Lind<juergen.l...@iteratec.de>
  wrote:

Thomas,

thanks for this hint, didn't know about that... So the script is executed
every time the
component is updated in an ajax call, correct? If so, it would surely
solve


For every rerender of the component. That includes non-Ajax (whole
page) requests as well.

some of my
issues. For longer scripts, I would still prefer to have them in the
markup
file (might be
different if we had multiline strings in Java, btw)


For longer scripts you can create JS helpers like:

in some.js:
var helper = function(selector) {
   // something longer here
}

is Some.java:

response.renderOnDomReadyJavaScript("helper($('#" + getMarkupId() +"');");


J.


On 04.06.2012 20:32, Thomas Götz wrote:


What about this?


public class MyComponent extends Panel {

     public MyComponent(String id) {
         super(id);
         setOutputMarkupId(true);
     }

     @Override
     public void renderHead(IHeaderResponse response) {
         response.renderOnDomReadyJavaScript(
                 "$('#" + getMarkupId() + "
.ttr').tipTip({defaultPosition:
'right'});");
     }

}

    -Tom


On 04.06.2012, 19:21 Jürgen Lind wrote:

[…]
      <wicket:script>
         $(document).ready(function() {
           $("#markupId .ttr").tipTip({defaultPosition: "right"});
         });
      </wicket:script>
[…]




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Mit freundlichen Grüßen,

Jürgen Lind

--
Dr. Jürgen Lind
iteratec GmbH                Fon: +49 (0)89 614551-44
Inselkammerstrasse 4         Fax: +49 (0)89 614551-10
82008 Unterhaching           Web: www.iteratec.de

Sitz und Registergericht der iteratec GmbH: München HRB 113 519
Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






Mit freundlichen Grüßen,

Jürgen Lind

--
Dr. Jürgen Lind
iteratec GmbH                Fon: +49 (0)89 614551-44
Inselkammerstrasse 4         Fax: +49 (0)89 614551-10
82008 Unterhaching           Web: www.iteratec.de

Sitz und Registergericht der iteratec GmbH: München HRB 113 519
Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to