我有一個Grails 2.4.4應用程序,想實現一個GSP一個利用jQuery DataTable。我看到有一個老DataTable plugin,但它看起來無人維護和使用Grails 2.x版本不兼容更何況,還有應該是一個辦法簡單地包括任何 JS LIB Grails中沒有明確要求它的插件。如何導入jQuery的數據表到Grails的2.4.4
這裏是我的BuildConfig
的plugins
部分:
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"
}
對於這個quesiton範圍之外的原因,我不能刪除或更改在plugins
部分中的任何現有的宣言,但我可以添加到他們。我聽說,稱爲「資產管道」的東西是將JS庫添加到Grails應用程序的新酷酷方式,但是我可以在該管道中找到的所有文獻都是模糊和高級的。我找不到任何真實世界的具體例子,使用這個管道將數據表包含在Grails應用程序中。
的 「!的Hello World」 的DataTable的版本似乎是這樣的:
<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();
});
於是我問:如何去我得到了(上圖)的 「Hello World」 的DataTable行駛的GSP內?什麼具體 CONFIGS,插件,等我需要線了,使這項工作?