giterlizzi / dokuwiki-plugin-datatables

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

Use with csv plugin #21

Open Netsaver opened 8 years ago

Netsaver commented 8 years ago

Hi, I find this plugin very useful. Indeed I alreday used it with the header-footer plugin, inserting a script with reference to external datatables js files. It worked fine, but that plugin breaks the section editing, so I had to give up. The point is that often the pagination and search capabilities are relevant for big tables, and big tables are uncomfortable to edit within the page. So often I use the csv plugin to reference a local csv file. I tried to enable datatables for csv local tables, but this was possible only enabling datatables for ALL tables in the wiki configuration (not just surrounding csv tag with datatables tag). Do you know another way to to this? Or in alternative to PREVENT a table to be processed by datatable plugin when ALL well-formatted tables are enabled. Just as foot note, is it possible to save a long option string as default (where?) to avoid inserting it for each table? Thanks and regards, Netsaver, Rome, IT

giterlizzi commented 8 years ago

Hi! Thanks for using my plugin and for your questions.

I use an other alternative to deference a big table. In my live demo, i have a big table placed in other DokuWiki page and i use include + datatable syntax in other DokuWiki page:

<datatable>
{{page>my-dw-table-page&inline&noheader&nofooter}}
</datatable>

This plugin offer only excludedPages regex to exclude namespace anr/or single page from DataTables rendering. Another solution are to add a macro in DokuWiki page to explicit exclude a rendering with Datatables.

I'm to study to set globally the most important options (like scroll-x, scroll-y, dom, info, etc.) in Configuration Manager like pagelist (https://www.dokuwiki.org/plugin:pagelist) and tag (https://www.dokuwiki.org/plugin:tag) plugins.

At your disposal, Joseph, Rome, IT

MvErven commented 7 years ago

Ah, I see what I did wrong, nvermind.

ascholtz commented 6 years ago

Hello,

Seems like this no longer works, because the csv plugin (no longer) surrounds the th class 'es with or generates a <thead></thead>?

No sure if this makes sense, but I am unable to get it to work.. It just renders a table that's not searchable or sortable etc.

Is there a way to get the include + datatables to work again?

Much appreciated,

Andrej

P.S.: Also asking for help here: https://github.com/cosmocode/csv/issues/15

ascholtz commented 6 years ago

I think I might have fixed the csv plugin. Seems to work with datatables header-rows="true"as well as csv hdr_rows=0 or 1 and higher. Please feel free to comment and validate, I do not know php..

diff -r M:\Toolbox\Dev\DokuWiki\csv plugin\table.php M:\Toolbox\Dev\DokuWiki\csv plugin\table.php.patched
92,94d91
<             if($line == 0 && $opt['hdr_rows'] > 0 ) {
<                 $renderer->tablethead_open();
<             }
134,136d130
<             if($line == $opt['hdr_rows'] - 1 ) {
<                 $renderer->tablethead_close();
<             }