Error when loading : "Uncaught TypeError: g is null"

Error when loading : "Uncaught TypeError: g is null"

olivierGolivierG Posts: 17Questions: 4Answers: 0
edited May 2021 in Responsive

Hi,
I have a table which works fine without responsive.
When I load the responsive files and add "responsive: true" in the parameters, the table does not draw and I get "Uncaught TypeError: g is null" in the console.

-Test case : https://cpts-france.fr/cpts-trois-monts/datatables-responsive/
-The dataTables debugger shows no error.
-The script and style loaded are :
https://cdn.datatables.net/v/dt/dt-1.10.24/b-1.7.0/b-html5-1.7.0/b-print-1.7.0/r-2.2.7/datatables.min.css
https://cdn.datatables.net/v/dt/dt-1.10.24/b-1.7.0/b-html5-1.7.0/b-print-1.7.0/r-2.2.7/datatables.min.js

Thank you for your help.
Olivier

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,141Questions: 26Answers: 4,736
    edited May 2021 Answer ✓

    Interesting. I copied your table into this test case:
    http://live.datatables.net/vuwedeba/1/edit

    The problem seems to be with the first footer row:

                <tfoot>
                    <tr id="titre-filtres">
                    </tr>
    

    It seems responsive does not like footers that don't have columns for each table column. Remove that line and Datables properly initializes. Makes sense as responsive handles the footer as well. @alllan or @colin can confirm.

    Kevin

  • olivierGolivierG Posts: 17Questions: 4Answers: 0

    Many thanks !

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Yep, exactly. It would also be worth running through a HTML validator as that's also picking up others - i.e. double </table> and a missing <tr> in the <thead>

    Colin

This discussion has been closed.