JQuery DataTables Plugin

  • Authors: Lim Chee Kin
1 vote
Dependency:
compile ":jquery-datatables:1.7.5"

 Documentation

Summary

Description

Overview

This plugin simply supplies jQuery DataTables plugin resources, and depends on the jQuery plugin to include the core jquery libraries.

Use this plugin in your own apps and plugins to avoid resource duplication and conflicts.

Special thanks to Eric Turner written a great blog post about "Using jQuery DataTables In Grails".

Note for developers working with this plugin

This plugin just provides the resources and a tag to include them. It must not include tags to add new functionality or wrap jQuery DataTables features.

If you need a newer version of jQuery DataTables than is currently available with this plugin you can update this plugin in grails SVN yourself. The original author has no desire to manage releases - provided you follow the clear conventions set out, all users of this plugin will be happy! Be my guest and release new versions as and when - just don't break anything for existing users. That means:

  • Always include all jQuery DataTables resources such as jquery.dataTables.js, jquery.dataTables.min.js, demo_table.css, demo_table_jui.css and images.
  • Don't add any functionality tags to this plugin
IMPORTANT: Make sure the version number of the plugin and the jQuery DataTables distribution is the same.

Conventions

The version number of this plugin must always follow the version number of the jQuery DataTables version it bundled.

E.g. the first release of this plugin is 1.7.5 - because it ships jQuery DataTables 1.7.5. If jQuery DataTables upgrades to 1.7.6 or similar, this plugin would need to be upgraded to use it and use the version number 1.7.6.

The key part is that any apps/plugins can install or dependsOn "jqueryDatatables" of a given version e.g. 1.7.5 to pull in that version of jQuery DataTables.

This plugin must dependsOn the minimum version of jQuery required by the jQuery DataTables. E.g. in this release that is jQuery 1.3.2 which is a separate grails plugin that also matches this versioning convention.

Tags

There is one tag - <jqDT:resources/> - which pulls in the resources needed. The tag supports the following attributes:

Type of resources

type = js|css

Optional. If this attribute is unspecified, it will pull in all JavaScript and CSS resources.

jQuery UI Theme support

jqueryUi = true|false

Optional. If this attribute is unspecified, the plugin will using default jQuery DataTables theme. If you specified jqueryUi = true, you need to install the jQuery UI plugin into your project.

Configuration

Minified version of Javascript file

You can choose if the minified version of the .js shoud be used (or not) by adding the following config parameter to your project's Config.groovy:

jqueryDataTables.minified = true|false

default: serve minified