DataTables requires tables to have a thead
DataTables requires tables to have a thead
RdeBoer
Posts: 10Questions: 0Answers: 0
Thanks so much for this library!
I'm preparing a new Drupal module to integrate DataTables across any Drupal site. It works great already except that
DataTables does not seem to cope when there is no in the table, even when sorting is turned off.
Why not put the in? Well it's because some of the tables are generated by the Drupal "core" and I have no control over that.
With just the search-box (bFilter) on, and no sorting, the browser console will display this error:
"Uncaught TypeError: Cannot read property 'asSorting' of undefined" (jquery.dataTables.js, line #6709)
With both the search-box and sorting on some columns:
"Uncaught TypeError: Cannot call method 'fnSetData' of undefined" (jquery.dataTables.js, line #824)
Thanks so much for looking into this!
I'm using Datatables v1.9.4 and the test-table I've used is this one:
[code]
Head1
Head2
Head3
Info
Drupal
7.23
OK
Access to update.php
Whatever...
OK
CTools CSS Cache
Exists
Warning
Coder review
PHP_CodeSniffer not installed.
[/code]
I'm preparing a new Drupal module to integrate DataTables across any Drupal site. It works great already except that
DataTables does not seem to cope when there is no in the table, even when sorting is turned off.
Why not put the in? Well it's because some of the tables are generated by the Drupal "core" and I have no control over that.
With just the search-box (bFilter) on, and no sorting, the browser console will display this error:
"Uncaught TypeError: Cannot read property 'asSorting' of undefined" (jquery.dataTables.js, line #6709)
With both the search-box and sorting on some columns:
"Uncaught TypeError: Cannot call method 'fnSetData' of undefined" (jquery.dataTables.js, line #824)
Thanks so much for looking into this!
I'm using Datatables v1.9.4 and the test-table I've used is this one:
[code]
Head1
Head2
Head3
Info
Drupal
7.23
OK
Access to update.php
Whatever...
OK
CTools CSS Cache
Exists
Warning
Coder review
PHP_CodeSniffer not installed.
[/code]
This discussion has been closed.
Replies
Unless Drupal can be modified, I'd suggest using a but of Javascript to modify the DOM, inserting the elements required to make the table valid.
Allan