giterlizzi / dokuwiki-plugin-datatables

Add DataTables support to DokuWiki
GNU General Public License v2.0
10 stars 11 forks source link

Complex Headers not working properly #6

Closed stevenj closed 8 years ago

stevenj commented 9 years ago

https://datatables.net/examples/basic_init/complex_header.html shows datatables with rowspan and colspan complex headers. The equivalent table in dokuwiki is something like :

<datatables>
^ Name ^^
^ First ^ Last ^
| My | Name |
| Your | Name |
</datatables>

That doesn't work, none of the Datatables elements appear on the page. Moving the ^ Name ^^ outside the datatables section makes the table elements appear again, but the header is obviously displayed wrong.

ghybs commented 8 years ago

Hi,

Indeed it looks like the JavaScript of DokuWiki DataTables plugin scopes out any table with row- or col-span, even if it is used only in the table headers (as advertised in the complex header example you mention).

The initial intent is surely to exclude tables that use row- or col-span in their tbody, because such situation is not supported by the DataTables library. However, it is supported in the table thead.

You could try to fix it yourself by modifying the script.js file, line 25:

if (! $target_table.find('[rowspan], [colspan]').length) {

by:

if (! jQuery('tbody', $target_table).find('[rowspan], [colspan]').length) {

Hope this helps.

ghybs commented 8 years ago

Hi again,

The plugin is now merged with pull request #8, so it should work by simply updating it through DokuWiki. Thanks to @LotarProject for having accepted the PR.

Hope this helps.