I don't know if it's helpful or (given your already coded js) usable, but there is a clone of jquery for gwt. It's called GQuery. Take a look http://code.google.com/p/gwtquery/
On 9 Nov, 21:58, Yaakov <yaakov.chai...@gmail.com> wrote: > Hi, > > I have a page that a web designer produced and now I need to add GWT > into it. > > I placed the contents of the HTML between <body> (not including it) > into a uiBinder <g:HTMLPanel></g:HTMLPanel>. > > In the host page, I have some headers that refer to jQuery and > javascript that the designer wrote, like this: > <head> > <link rel="stylesheet" type="text/css" href="resources/css/ > styles.css" /> > <script type="text/javascript" src="resources/js/ > jquery.tools.min.js"></script> > <script type="text/javascript" src="resources/js/application.js"></ > script> > <script type="text/javascript" language="javascript" > src="keyImportActivity/keyImportActivity.nocache.js"></script> > </head> > > Some of the visual affects that the designer used are from jQuery and > the way these get bound to some HTML elements are through a jQuery- > specific window.onLoad function "$(function(){ some bindings here}); > > Here is the code from that application.js referred to above in the > <head>: > $(function() { > > setButtonClasses("buttonPlus"); > setButtonClasses("buttonMinus"); > setButtonClasses("buttonRefresh"); > setButtonClasses("buttonAdmin"); > setButtonClasses("buttonImports"); > setButtonClasses("buttonInventory"); > setButtonClasses("buttonSignOut"); > setButtonClasses("buttonNewer"); > setButtonClasses("buttonOlder"); > setButtonClasses("sortAscending"); > setButtonClasses("sortDescending"); > > $("div.buttonPlus").click(leftNavigationHandler); > $("a.lightbox").click(doPopup); > > }); > > So, this doesn't work. My guess, this is because it gets called BEFORE > GWT even builds those buttons, etc., so at the time it supposedly gets > called, these elements don't exist yet or at least are not guaranteed > to exist yet. > > So, I changed this "onLoad" function and made it a regular function > like this: > function bindjQuery() { > alert("Inside JS bindjQuery"); > setButtonClasses("buttonPlus"); > setButtonClasses("buttonMinus"); > setButtonClasses("buttonRefresh"); > setButtonClasses("buttonAdmin"); > setButtonClasses("buttonImports"); > setButtonClasses("buttonInventory"); > setButtonClasses("buttonSignOut"); > setButtonClasses("buttonNewer"); > setButtonClasses("buttonOlder"); > setButtonClasses("sortAscending"); > setButtonClasses("sortDescending"); > > $("div.buttonPlus").click(leftNavigationHandler); > $("a.lightbox").click(doPopup); > > } > > Now, in my EntryPoint, I have this: > public class KeyImportActivityEntryPoint implements EntryPoint { > > public void onModuleLoad() { > KeyImportWidget keyImportWidget = new KeyImportWidget(); > RootLayoutPanel.get().add(keyImportWidget); > > bindjQuery(); > } > > public native void bindjQuery() /*-{ > alert("Inside GWT bindjQuery"); > $wnd.bindjQuery(); > }-*/; > > } > > So, this works... The problem is... I don't like it. :-) Is this the > recommended way of importing things like that? I am uncomfortable with > this as I have no clue what else JQuery might be doing in its other > functions... For all I know, it uses its "onLoad" function somewhere > else as well and it never gets called. So, just because this worked > for whatever I am doing, it doesn't seem like this is the cleanest > approach. > > Can someone please give me some tips on this? > > Much appreciated! > > -Yaakov. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.