I have a Grails 2.4.4 application and am trying to implement a GSP that uses jQuery DataTable . I see that there is an old DataTable plugin , but it looks unresponsive and incompatible with Grails 2.x. Not to mention that there should be a way to simply include any JS library in Grails, without explicitly requiring a plugin for it.
Here's the plugins section of my BuildConfig :
plugins { build ":release:3.0.1" build ":tomcat:7.0.52.1" compile "org.grails.plugins:gson:1.1.4" compile ":rest-client-builder:1.0.3" compile ":yammer-metrics:3.0.1-2" runtime ":jquery:1.11.1" runtime ":cached-resources:1.0" runtime ":resources:1.2.14" compile ":cache-headers:1.1.7" compile ":rest-client-builder:1.0.3" compile ":export:1.6" compile ":standalone:1.2.3" compile ":cache-headers:1.1.7" compile ":scaffolding:2.1.2" compile ':cache:1.1.3' runtime ":resources:1.2.14" runtime ":hibernate:3.6.10.15" runtime ":database-migration:1.4.0" runtime ":jquery:1.11.1" }
For reasons beyond the scope of this quesiton, I cannot delete or modify any existing ads in the plugins section, but I can add to them. I heard that something called an βasset pipelineβ is a cool new way to add JS libraries to your Grails application, but all the literature I can find on this pipeline is vague and high-level. And I cannot find real, real-life examples of using this pipeline to include DataTables in a Grails application.
"Hello World!" The version of DataTable is as follows:
<table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>Name</th> <th>Position</th> <th>Office</th> </tr> </thead> <tbody> <tr> <td>Tiger Nixon</td> <td>System Architect</td> <td>Edinburgh</td> </tr> ...lots of more rows </tbody> </table> $(document).ready(function() { $('#example').DataTable(); } );
So I ask: How can I get (above) the DataTable "Hello World" working inside the GSP? What specific configurations, plugins, etc. I need to connect to make this work
smeeb source share