• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Grails and jQuery: how to get image to show that the user just typed in the URL to

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it worth it to use JQuery in your Grails app.

I still need to learn JQuery, but I would also have to learn Prototype if I used it.

Anyway, I want to show or hide some <div> based on if someone entered data in a property of my domain. So while editing that domain. Basically they are going to put a URL to an image, and I want to show that image on the page after they have entered it.

What is my best approach? OK, I changed the subject, let me update the subject line.

Thanks

Mark
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use jQuery for everything, as long as I get to make the decision.

Major untested pseudo code alert!!!



Also, moving this to the HTML / JavaScript forum.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark Spritzler wrote:I still need to learn JQuery, but I would also have to learn Prototype if I used it.


"It" Grails, or "it" jQuery? I think Grails supports a couple of different JS libs, but I don't recall that jQuery was one of them. There's a plugin, though:

http://www.grails.org/plugin/jquery
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:

Mark Spritzler wrote:I still need to learn JQuery, but I would also have to learn Prototype if I used it.


"It" Grails, or "it" jQuery? I think Grails supports a couple of different JS libs, but I don't recall that jQuery was one of them. There's a plugin, though:

http://www.grails.org/plugin/jquery



Well, it's support via the plugin. So if you install the plugin and make a couple of config mods, all the grails ajaxy tags will use jQuery instead of Prototype (the default). And that's really all the support is.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gregg Bolinger wrote:

David Newton wrote:

Mark Spritzler wrote:I still need to learn JQuery, but I would also have to learn Prototype if I used it.


"It" Grails, or "it" jQuery? I think Grails supports a couple of different JS libs, but I don't recall that jQuery was one of them. There's a plugin, though:

http://www.grails.org/plugin/jquery



Well, it's support via the plugin. So if you install the plugin and make a couple of config mods, all the grails ajaxy tags will use jQuery instead of Prototype (the default). And that's really all the support is.



So this takes it back to being a Grails question. The original question was about those config mods, what they mean, is it worth jumping through those hoops, or is it just 2 mods and then automatically you can use the jQuery type code you posted?

Mark
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used the jQuery plugin, but I'm not sure why it would need anything beyond the two things mentioned in the wiki article.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<g:javascript library="jquery" />

And in the Config.groovy file you add....

grails.views.javascript.library="jquery"

That's it. No hoops.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And technically, you only need the Config.groovy addition if you want the Grails remote taglibs to use jquery. Personally, I never use those tags, so all I need is to source in the jquery js file, which is what the <g:javascript /> is for.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gregg Bolinger wrote:And technically, you only need the Config.groovy addition if you want the Grails remote taglibs to use jquery. Personally, I never use those tags, so all I need is to source in the jquery js file, which is what the <g:javascript /> is for.



Thanks, and I assume if I just put that in my main.gsp layout, then all the pages will get that.

Things have been going really well too.

Mark
 
He puts the "turd" in "saturday". Speaking of which, have you smelled this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic