Grails 2.4 Enable jquery-ui

My grails application uses jquery-ui and twitter bootstrap. I use the default application.js structure. Then I add the following line to enable jquery-ui and bootstrap.js:

... //= require jquery //= require jquery-ui //= require bootstrap ... 

Bootstrap bootstrap.js is loaded correctly, but jquery-ui.js is not enabled.

+6
source share
3 answers

Assuming you are using the jquery-ui grails plugin, it is not included because the current version does not have a directory file under grails-app/assets/jquery-ui . Instead, it uses the web-app directory to put javascript files in a jquery-ui/js subfolder, as you see in the sources .

To get jquery-ui working, you have to put the following line in your directive file:

 //= require jquery //= require jquery-ui/js/jquery-ui-1.10.3.custom.min //= require bootstrap 

In bootstrap, this works out of the box because they use the directive file in grails-app/assets/javascript , as you see here .

+8
source

I had to use the following settings (for these versions):

Grails app / CONF / BuildConfig.groovy

 compile ":asset-pipeline:1.9.9" runtime ":jquery:1.11.1" runtime ":jquery-ui:1.10.3" 

Grails app / assets / JavaScripts / foobar.js

 //= require jquery //= require js/jquery-ui-1.10.3.custom 

Grails app / assets / style sheets /foobar.css

 /* *= require themes/ui-lightness/jquery-ui-1.10.3.custom */ 
+11
source

this line also worked for me:

  //= require jquery-ui/js/jquery-ui-1.10.3.custom.min 
0
source

Source: https://habr.com/ru/post/971583/


All Articles