Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82234

SearchPanes raises an error if $.fn.dataTable.defaults contains language.url

$
0
0

Link to test cases:
https://pilierpublic.com/tmp/datatables/
https://pilierpublic.com/tmp/datatables/OK

(respectively, containing 'language.url' -> raises an error, and without 'language.url' -> it works OK)

What I have found so far...

If 'language' is defined and contains 'url', the events 'init.dt' and 'draw.dt' are raised at page load...
but pressing on the "SearchPanes" button results in error:

Uncaught TypeError: Cannot read properties of undefined (reading 'scrollHeight')
    at _fnScrollDraw (datatables.js:16573:32)
    at _fnAdjustColumnSizing (datatables.js:13705:4)
    at _Api.<anonymous> (datatables.js:20138:4)
    at _Api.iterator (datatables.js:18258:15)
    at _Api.<anonymous> (datatables.js:20137:15)
    at Function.adjust (datatables.js:18378:17)
    at _Api.<anonymous> (datatables.js:20098:19)
    at _Api.iterator (datatables.js:18258:15)
    at _Api.<anonymous> (datatables.js:20077:9)
    at _Api.visible (datatables.js:18378:17)

By commenting out 'url' (or all of 'language'), the events 'init.dt' and 'draw.dt' are NOT raised at page load...
but pressing on the "SearchPanes" button works fine!

Test environment: DataTables 2.0.2 with Bootstrap 4 integration + JQuery 3.7.1, exactly like the examples on the DataTables website. Omitting Bootstrap .js and .css will results in the exact same error.

IMO, this is a bug inside the SearchPanes extension.

As I was investigating this issue, I also found out that SearchPane.prototype._getPaneConfig() was overwriting the DataTables settings:

            var langOpts = this.s.dt.settings()[0].oLanguage;
            langOpts.url = undefined;
            langOpts.sUrl = undefined;

The first of these lines should probably be changed to:

            var langOpts = Object.assign({}, this.s.dt.settings()[0].oLanguage);

Viewing all articles
Browse latest Browse all 82234

Trending Articles