View Full Version : Include jQuery js.
ShurikAg
Dec 21st, 2010, 03:54 PM
Hi,
I'm looking into the jQuery plugin: http://www.grails.org/plugin/jquery
and as described in docs I have added:
<g:javascript library="jquery" plugin="jquery"/>
to the layout.
but this tag is rendered as:
<script type="text/javascript" src="/timeorg/plugins/jquery-1.4.4/js/jquery/jquery-1.4.3.js"></script>
instead of something like:
<script type="text/javascript" src="/timeorg/js/jquery/jquery-1.4.3.min.js"></script>
What am I missing?
ShurikAg
Dec 21st, 2010, 03:54 PM
OK I've got it to the point that the tag renders as:
<script type="text/javascript" src="/timeorg/plugins/jquery-1.4.4/js/jquery/jquery-1.4.4.js"></script>
But where is this file is coming from?
I don't have jQuery-1.4.4 in my project, just 1.4.3
and why it's not pulling the minified version?
burtbeckwith
Dec 21st, 2010, 03:57 PM
There's a bug in the plugin; I described a workaround on the User mailing list here: http://grails.1312388.n4.nabble.com/Spring-Security-Management-Console-td3095815.html
The User mailing list has a lot more subscribers than this forum, so you might want to ask questions there. The Dev list is for discussion of Grails development though, so usage questions aren't relevant there.
ShurikAg
Dec 21st, 2010, 04:06 PM
Thanks, but when I'm trying to install jQuery by running this:
grails installJQuery
it still installs 1.4.3 ???
burtbeckwith
Dec 21st, 2010, 04:10 PM
Probably, I haven't used that script. The plugin comes with the jQuery javascript file, so you can use that directly as shown in the docs, e.g.
<g:javascript library='jquery' plugin='jquery' />
ShurikAg
Dec 21st, 2010, 04:12 PM
Where is this file located?
burtbeckwith
Dec 21st, 2010, 04:16 PM
$HOME/.grails/<grailsversion>/projects/<projectname>/plugins/jquery-1.4.4/web-app/js/jquery
The <g:javascript> tag figures that out though. You just need to make the Config.groovy change I posted.
ShurikAg
Dec 21st, 2010, 04:22 PM
I did, but my problem now is where is the file coming from. Because I don't have 1.4.4 in my project path.
Who can I forse to use my file in 'js/jquery' folder?
burtbeckwith
Dec 21st, 2010, 04:23 PM
It's not in your project path, it's where I said it is - in the plugin source under the .grails folder. The primary purpose of the plugin is to reduce duplication.
ShurikAg
Dec 21st, 2010, 04:45 PM
OK, another question then:
What happens when the application is deployed? Will the app create the same structure on the server on deploy?
burtbeckwith
Dec 21st, 2010, 04:46 PM
Yes. This is easy to test - run "grails prod run-war" or just run "grails war" and unpack the war file from the target folder to examine its contents.
ShurikAg
Dec 21st, 2010, 04:50 PM
Yes. This is easy to test - run "grails prod run-war" or just run "grails war" and unpack the war file from the target folder to examine its contents.
hmmm.... nice!
Thank you!
rickey121
Jan 13th, 2012, 06:44 AM
this would be a great instance to make use of the jQuery library.
Struts2 Jquery (http://www.ezdia.com/epad/tutorial-jquery-struts-2-framework/319/)
In this there are codes of jquery and you will get to know how to make best use of it. Also provided a video for better understanding.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.