Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 3.0 <g:remoteLink ...> Ajax call replacement due to deprecation

Grails 3.0.0 M1 states that g:remoteLink is deprecated and in 3.0.1 it no longer exists in the g: namespace. There is nothing in the documentation that suggests replacement of this functionality. Will someone please respond with a replacement option for GSP files to execute a controller action using the Prototype JavaScript library? If also possible, would a solution utilizing a Groovy custom tag library to eliminate embedded code directly in GSP files be presented?

like image 256
TeamDitto Avatar asked Jun 12 '15 22:06

TeamDitto


1 Answers

The tags use inline javascript embedded into HTML tags which has long been considered bad practise. At the same time the APIs for creating remote links with JavaScript frameworks like jQuery and so on have advanced to the point where it is just as easy to use them and they have the advantage that the static resources can be optimised by asset pipeline and your application will perform better.

So given how things have changed over the last few years the Grails team decided to deprecate the tags as they are no longer considered best practise and you are better off using the native JavaScript APIs (jQuery etc.) as an alternative.

The original tags are still available at https://bintray.com/grails/plugins/ajax-tags

If you want them you have to declare a dependency:

compile 'org.grails.plugins:ajax-tags:1.0.0.RC1'
like image 171
Graeme Rocher Avatar answered Oct 01 '22 08:10

Graeme Rocher