giterlizzi / dokuwiki-plugin-datatables

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

Plugin does not work any more after update to Hogfather #51

Closed tmo26 closed 3 years ago

tmo26 commented 4 years ago

Problem: After update from Greebo to Hogfather, datatables functions are not available any more, e.g. search-field on the right side of the table is missing. Debugger shows TypeError: $thead.size is not a function:

Example page: https://openwrt.org/meta/fwfiles_datatable

Console output: grafik (some png/gif loading skipped) grafik

Debugger output: grafik

giterlizzi commented 4 years ago

Hi, Hogfather now use the "defer" attribute for speedup the JS loading but this attribute break some plugins. You can temporary disable the defer attribute using defer_js option in Configuration Manager (see https://www.dokuwiki.org/config:defer_js).

I'm working to release a new version of plugin with an updated version of DataTables and a fix for this issue without a workaround.

tmo26 commented 4 years ago

You can temporary disable the defer attribute using defer_js option in Configuration Manager (see https://www.dokuwiki.org/config:defer_js).

The above result is already with defer_js unchecked.

tmo26 commented 4 years ago

I just rechecked with the latest master

Installed version: 2020-06-14 Your last update: Wed, 17 Jun 2020 14:58:15 +0000

with defer_fs checked and unchecked, the datatables search-field is not there.

giterlizzi commented 4 years ago

Please paste the errors in JS console.

tmo26 commented 4 years ago

grafik

chris-lambert-shiels commented 4 years ago

Same issue here. Also noticed that iIf the tag has no attribute such as paging, or the attribute value is junk paging="junk" then the defaul Search box and Page Length selector appear. But if paging="true" then the Datatables functionality is lost. So might it be a parsing issue? JS Console below DevTools failed to load SourceMap: Could not parse content for https://stbens-glastonbury.uk/wiki/lib/plugins/datatables/assets/pdfmake/build/pdfmake.min.js.map: Unexpected token < in JSON at position 0 jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 jQuery.Deferred exception: b.hasOwnProperty is not a function TypeError: b.hasOwnProperty is not a function at Ya (https://stbens-glastonbury.uk/wiki/lib/plugins/datatables/assets/datatables.net/js/jquery.dataTables.min.js:75:377) at HTMLTableElement.<anonymous> (https://stbens-glastonbury.uk/wiki/lib/plugins/datatables/assets/datatables.net/js/jquery.dataTables.min.js:85:455) at Function.each (https://stbens-glastonbury.uk/wiki/lib/exe/jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2:2976) at S.fn.init.each (https://stbens-glastonbury.uk/wiki/lib/exe/jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2:1454) at S.fn.init.n [as dataTable] (https://stbens-glastonbury.uk/wiki/lib/plugins/datatables/assets/datatables.net/js/jquery.dataTables.min.js:83:388) at S.fn.init.h.fn.DataTable (https://stbens-glastonbury.uk/wiki/lib/plugins/datatables/assets/datatables.net/js/jquery.dataTables.min.js:166:333) at init_datatables (https://stbens-glastonbury.uk/wiki/lib/exe/js.php?t=dokuwiki&tseed=54ed5ba6f8aca9f150e405c7e17174b2:1:98658) at HTMLTableElement.<anonymous> (https://stbens-glastonbury.uk/wiki/lib/exe/js.php?t=dokuwiki&tseed=54ed5ba6f8aca9f150e405c7e17174b2:1:99190) at Function.each (https://stbens-glastonbury.uk/wiki/lib/exe/jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2:2976) at S.fn.init.each (https://stbens-glastonbury.uk/wiki/lib/exe/jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2:1454) undefined S.Deferred.exceptionHook @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 t @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 setTimeout (async) (anonymous) @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 c @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 fireWith @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 fire @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 c @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 fireWith @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 ready @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 B @ jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2 Uncaught TypeError: b.hasOwnProperty is not a function at Ya (jquery.dataTables.min.js:75) at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:85) at Function.each (jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2) at S.fn.init.each (jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2) at S.fn.init.n [as dataTable] (jquery.dataTables.min.js:83) at S.fn.init.h.fn.DataTable (jquery.dataTables.min.js:166) at init_datatables (js.php?t=dokuwiki&tseed=54ed5ba6f8aca9f150e405c7e17174b2:1) at HTMLTableElement.<anonymous> (js.php?t=dokuwiki&tseed=54ed5ba6f8aca9f150e405c7e17174b2:1) at Function.each (jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2) at S.fn.init.each (jquery.php?tseed=5bb1a98b139b46abd22c69cae01d7704:2)

chris-lambert-shiels commented 4 years ago

As above removing attributes from the <datatables> tag makes the "TypeError: b.hasOwnProperty is not a function" go away. The stack dump suggests the problem is in jquery 3.5.0 - e.g. see https://github.com/snapappointments/bootstrap-select/issues/2430

chris-lambert-shiels commented 4 years ago

OK so it is in Jquery https://github.com/jquery/jquery/issues/4665 "an unintended breaking change that we should fix in 3.5.1"

chris-lambert-shiels commented 4 years ago

Seems like it's an epidemic, e.g.

The latter says "currently downgrading jQuery from 3.5.0 to 3.4.1 is the only option until 3.5.1 is released"

Could someone cleverer than me say how to do this - e.g. datatables / dokuwiki on Debian in my case?

chris-lambert-shiels commented 4 years ago

JQuery 3.5.1 was released in May - https://blog.jquery.com/2020/05/04/jquery-3-5-1-released-fixing-a-regression/

ScottOfford commented 4 years ago

I've been able to get it working by editing the file /lib/plugins/datatables/assets/datatables.net/js/jquery.dataTables.min.js and replacing the following items: a.hasOwnProperty(d) with Object.prototype.hasOwnProperty.call(a,d) b.hasOwnProperty(e) with Object.prototype.hasOwnProperty.call(b,e) i.hasOwnProperty(a) with Object.prototype.hasOwnProperty.call(i,a)

DocuWiki version Release rc-2020-06-09 "Hogfather" RC3 Installed plugin version: 2020-06-14

pastebin of my edited file here.

This was suggested as a fix here

tmo26 commented 4 years ago

@ScottOfford I can confirm that your changes bring back the search field (although on the left side of the page, whereas is should be on the right side). Thanks for that! :)

Pagination however does not work correctly: there are no links behind the pagenumbers: grafik

giterlizzi commented 4 years ago

@ChrisLambertUK

splitbrain/dokuwiki#3192

tmo26 commented 3 years ago

Issue solved with Release 2020-07-29 "Hogfather" Bootstrap3 Template v2020-08-28 (develop/20210113) Datatables plugin Installed version: 2020-06-14