Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 1.85 KB

README.textile

File metadata and controls

53 lines (34 loc) · 1.85 KB

jQuery DataTables TableTools Play! Module

Background

jQuery

jQuery is a popular javascript toolkit.

jQuery DataTables

jQuery DataTables is a plugin for jQuery that makes it easy to provide ajax sorting, searching, and pagination on your tabular data.

jQuery DataTables TableTools

jQuery DataTables TableTools is an extra package can export the DataTable via Clipboard, CSV, Excel, PDF, and Print.

Play!

Play!" is an incredible web framework for Java.

Objective

This module makes it easy to add jQuery DataTables TableTools to your Play! project.

Quick start

To use TableTools on your (existing) jQuery datatable:

  • Download this module.
    $ git clone git://github.com/robfig/play-jquery-tabletools.git
    
  • Include this module by adding it to your application.conf (replace PATH_TO with the absolute or relative path to this module):
    module.jquery-tabletools=PATH_TO/play-jquery-tabletools
    
  • Include the javascript and css in your page:
    <script src="@{'/public/js/TableTools.min.js'}" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="@{'/public/css/TableTools.css'}">
    <link rel="stylesheet" type="text/css" href="@{'/public/css/TableTools_JUI.css'}">
  • Include the TableTools using ‘T’ in the ‘sDom’ setting, and set the path to the swf.
      $('#datatable').dataTable({
        ...
        "sDom": '<"H"lT>rt<"F"ip>',
        "oTableTools": {
          "sSwfPath": "@{'/public/swf/copy_cvs_xls_pdf.swf'}"
        },
      });

That’s it!

Note: you should have a route to staticDir:public in your conf/routes