Integrating jQuery with GWT application

3,306 views
Skip to first unread message

LoneWolf

unread,
Jun 30, 2008, 8:52:35 AM6/30/08
to Google Web Toolkit
Hi.
I want to use jQuery code to use this date picker:
http://ui.jquery.com/functional_demos/#ui.datepicker
The source:
----
$("#basics").datepicker();
<input type="text" size="10" value="click here" id="basics"/>
<style type="text/css">.embed + img { position: relative; left: -21px;
top: -1px; }</style>
----
How to integrate this code in GWT application?
Thanks.

Ian Petersen

unread,
Jun 30, 2008, 9:18:00 AM6/30/08
to Google-We...@googlegroups.com

I think Ray Cromwell has put together a GWT port of jQuery. If I
remember right, he called it GQuery. Search the archives and you
might find it.

Ian

Mike Hearn

unread,
Jun 30, 2008, 9:14:32 AM6/30/08
to Google Web Toolkit
Check out GwtQuery:

http://code.google.com/p/gwtquery/

It's jQuery, reimplemented in a GWT style to use the fancy compiler,
etc. It generates optimal code for each browser.

LoneWolf

unread,
Jul 1, 2008, 3:56:45 AM7/1/08
to Google Web Toolkit
Currently we are using GWT 1.4.61 and it seems to me that GQuery works
on GWT 1.5 (which it is now RC1, I think)
Any more ideas?
Thank you all for your time.

On Jun 30, 8:18 am, "Ian Petersen" <ispet...@gmail.com> wrote:

LoneWolf

unread,
Jul 3, 2008, 7:17:08 AM7/3/08
to Google Web Toolkit
Considering this code:
----
$("#basics").datepicker();
<input type="text" size="10" value="click here" id="basics"/>
<style type="text/css">.embed + img { position: relative; left: -21px;
top: -1px; }</style>
----
Is it possible to create this HTML element by using GWT DOM API by
hand? and then include
$("#basics").datepicker();
in the GWT HTML page?

Piotr Findeisen

unread,
Aug 30, 2008, 12:03:33 PM8/30/08
to Google Web Toolkit
I have the same problem: I want o embed jQuery library in my GWT-
created page.
I know about GQuery and I already use GWT 1.5, but I need pure
Javascript jQuery -- I want to make use of some library depending on
it (jQuery modal, http://dev.iceburg.net/jquery/jqModal/).

I've tried to add proper <script src=...> entry in the .xml
configuration, but if I write $(...) in my JSNI methods, the exception
is thrown saying $ is undefined. (Using jQuery(...) doesn't help
either.)

Any idea what should I do?
Thanks,
Piotr

Reinier Zwitserloot

unread,
Aug 30, 2008, 2:38:22 PM8/30/08
to Google Web Toolkit
Use $wnd.$ instead.

On Aug 30, 6:03 pm, Piotr Findeisen <piotr.findei...@gmail.com> wrote:
> I have the same problem: I want o embed jQuery library in my GWT-
> created page.
> I know about GQuery and I already use GWT 1.5, but I need pure
> Javascript jQuery -- I want to make use of some library depending on
> it (jQuery modal,http://dev.iceburg.net/jquery/jqModal/).

Piotr Findeisen

unread,
Aug 30, 2008, 1:33:11 PM8/30/08
to Google Web Toolkit
> I've tried to add proper <script src=...> entry in the .xml
> configuration, but if I write $(...) in my JSNI methods, the exception
> is thrown saying $ is undefined. (Using jQuery(...) doesn't help
> either.)

Oh, I'm just stupid.
I turned out that I have to have the following in my configuration XML
file:
<script src="jquery.js"/>
<script src="jquery.modal.js"/>

I have to call jQuery through $wnd.$ or $wnd.jQuery,

*and* I have to restart the development shell for GWT to see the .js
files.

P.
Reply all
Reply to author
Forward
0 new messages