New User Blues - TypeError

New User Blues - TypeError

IMTanukiIMTanuki Posts: 50Questions: 10Answers: 0

Hi

I'm a new DataTables user - testing basic functionality on local machine (Netbeans)but getting the following error:

TypeError: cannot read property 'aDataSort' of undefined...

Could anyone point me in the right direction?

<html>
<head>
<title>DATA TABLES - TEST</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- CUSTOM HEADER DEF AND LINKS -->
    <link rel="shortcut icon" href="#">    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css">
    <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script>
                <script> $(document).ready( function () 
                {
                    $('#tableA').DataTable();
                }
                );
        </script>    
</head>

<body>
    <div>HANZI - RADICALS</div>
    <table id="tableA" class="display">
    <table style="width:100%">
        <thead>
            <tr>
                <th>Column 1</th>
                <th>Column 2</th>
                <th>Column 3</th>
                <th>Column 4</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Row 1 Data 1</td>
                <td>Row 1 Data 2</td>
                <td>Row 1 Data 3</td>
                <td>Row 1 Data 4</td>
            </tr>
        </tbody>    
    </table>        
</body>

</html>

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,364Questions: 26Answers: 4,777
    Answer ✓

    This line should not be there as it is declaring another table:
    <table style="width:100%">

    You should just have this on one line:
    <table id="tableA" class="display" style="width:100%">

    Kevin

  • IMTanukiIMTanuki Posts: 50Questions: 10Answers: 0

    Whoops...bad data = bad results.

    Pls disregard.

    This is a great tool!

  • IMTanukiIMTanuki Posts: 50Questions: 10Answers: 0

    Kevin

    Thanks for the quick reply! Fixed...

This discussion has been closed.