I don't think you mentioned your problem. What goes wrong ?!

On Sun, Oct 16, 2011 at 1:55 PM, joch40
<janko.jochim...@urios-beratung.de>wrote:

> Hello,
>
> I am quiet new to Tapestry and a bit lost in the moment. I try to integrate
> jquery in my project. I learn about the $ sign Problem I managed to
> integrate the Alert-Sample from
>
> http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
> http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
>
> into a tml page:
>
> this looks like the following and works
> <ul>
> </ul>
> <li> http://jquery.com/ jQuery </li>
>
>
>
>
>
>
> Now I would like to get the same thing done in an extra MyJQueryAlert.java
> Class.
>
> So I changed the tml page to
>
> <ul>
> <li> http://jquery.com/ jQuery </li>
> <div t:type="MyJQueryAlert" value="alert"/>
> </ul>
>
>
> And created an MyJQueryAlert.java in changing an working Example for
> Scriptaculous
>
>
> public class MyJQueryAlert {
>
>        @Inject
>        @Path("jquery-1.6.4.js")
>        private Asset myAlert;
>
>        @Environmental
>        private JavaScriptSupport javaScriptSupport;
>
>        public static final String EVENT_NAME = "alert";
>        private static final String PARAM_NAME = "t:MyJQueryAlert";
>
>        @Parameter(required = true)
>        private String value;
>
>        @Inject
>        private ComponentResources resources;
>
>        @Log
>        void setupRender() {
>                javaScriptSupport.importJavaScriptLibrary(myAlert);
>        }
>
>        @Log
>        void afterRender(MarkupWriter writer) {
>                String elementName = resources.getElementName();
>                if (elementName == null)
>                        elementName = "span";
>
>                String clientId =
> javaScriptSupport.allocateClientId(resources.getId());
>                writer.element(elementName, "id", clientId);
>                resources.renderInformalParameters(writer);
>                 if (value != null)
>                 writer.write(value);
>                 writer.end();
>                JSONObject config = new JSONObject();
>                config.put("paramName", PARAM_NAME);
>                String scriptstring = "jQuery.noConflict();
> jQuery(document).ready(function(){ jQuery(%s).click(function(event){
> alert(%s); event.preventDefault();      });     });";
>
>                Link link = resources.createEventLink(EVENT_NAME);
>                javaScriptSupport.addScript(scriptstring, "a",
>                                "Test Alarm");
>        }
>
> }
>
> To be honest I don´t understand all things that are going on here and for
> sure this doesn´t work.
>
> The Log shows that afterRender gets called and that jquery-1.6.4.js has
> been
> found.
>
> I searched quiet a while but there seems to be not help for this Problem.
> So
> can anybody give me an advice.
>
>
> Thanks
>
> Janko
>
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Practical-jQuery-Integration-tp4906814p4906814.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
*Regards,*
*Muhammad Gelbana
Java Developer*

Reply via email to