Closed (fixed)
Project:
DataTables
Version:
6.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
15 Dec 2009 at 16:54 UTC
Updated:
26 Mar 2012 at 16:00 UTC
One of the good sides of Datatables.js how it implements on html-tables.
And any html-table in node can have this jquery add-on.
1. Does or will this module give this like functionality, maybe adding css class to html-tables or it will only work with views-tables?
1.1. And if the answer is "no" could i use your module for views-tables and in parallel use datatables.js for html-tables?
2. Will this module use datatables.js only on client-side or server-side or both.
thx for the answers.
Comments
Comment #1
duellj commented1. There is functionality to output tables as DataTables, using similar format to theme a table:
There's no documentation in the module on how to correctly format the input to this theme, but it's coming soon (working on it). To include this in a node, you would need php filter access. If there is interest, I could work on creating a datatable macro.
2. Not sure what you mean by this question. datatables.js will behave like any javascript file, on the client-side.
Comment #2
jonr commentedHow do I enable this? Do I edit the template file? Can I hook it to a table id?
Comment #3
duellj commentedCurrently the main purpose of this module is to provide a views style plugin to output a view as a DataTable. If you're interested in hooking it into an existing tables, check out the examples at http://www.datatables.net/examples/
Comment #4
giorgio79 commentedHello duellj,
You mentioned you are working on documenting the theme function call.
Is this still on the table?
I would like to put input fields in the table columns, and use datatables for their arrangement. Currently I am putting them in regular html tables like here http://drupal.org/node/80270
Datatables would be fantastic for that.
Comment #5
giorgio79 commentedActually this stuff is way simple. :)
It can be used for any HTML table on the page :D
http://datatables.net/examples/basic_init/zero_config.html
Comment #7
zirvap commentedCould someone describe in a bit more detail how to use this for non-views tables?
I've installed the module and verified that it works for views.
I then tried editing page.tpl.php, inserting
in the header of the page, and using id="example" for my table, but with no visible results.
I've also tried looking at the source code for pages with views with data tables. I see the code for the data tables is included in entries like:
jQuery.extend(Drupal.settings, { ... "datatables": { "#datatable-1": ... } });and have tried some copy-and-paste, but I find that flailing around at semi-random doesn't get me far enough :-(
Comment #8
zirvap commentedI figured it out after a bit more flailing around.
In case others wonder:
When using this for non-views tables, I don't use this module. I just extract the library (from http://www.datatables.net/download/) in my sites/all/libraries. Then I edit page.tpl.php to put this in the header:
...and then I give my table
id="example"(Maybe it can be done more elegantly, but this works for me :-)
Comment #9
zirvap commentedHm, weird. The recipie above only works if I have a datatable from views (using this module) on the same page (say, in a block).
So I'm opening this again, in case someone can help me out here.
Comment #10
duellj commentedzirvap,
That's because the datatables library (collection of js and css) is only added during the view load, so you'll have to manually add the datatables library for your code to work: