Add Datatables plugin

Skirr - September 20, 2009 - 22:13
Project:jQuery plugins
Version:6.x-1.9
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Is it possible to add DataTables plugin ?
http://www.datatables.net
http://plugins.jquery.com/project/DataTables

#1

raintonr - October 30, 2009 - 22:26

It would be nice to see a Datatables module, but I can confirm that the latest (dt 1.5) works with latest jQuery shipped with Drupal.

You can write yourself a little module (guess you'd be doing this anyhow to fetch the data) and put this in the page generation code:

<?php
  drupal_add_js
(drupal_get_path('module', 'mymodule') . '/dataTables/media/js/jquery.dataTables.js');
 
drupal_add_js(drupal_get_path('module', 'mymodule') . '/mymodule.js');
?>

Where mymodule.js contains the ready function. Eg:

$(document).ready(function() {
  $('#dt_mymodule').dataTable();
} );

Sadly the theme_table function doesn't put <thead> tags in so I had to write my own, but aside from that looks to work just fine.

Unpack the dt zip file into your module directory and symlink dataTables to it (so you can easily switch between versions).

#2

Skirr - October 31, 2009 - 17:00

Yes, i tried this way, but it seems that IMCE module have conflict with datatables. Didnt figure it out yet, but all "download buttons" in imce disappear.

 
 

Drupal is a registered trademark of Dries Buytaert.