below is my datatable code,i m getting Uncaught TypeError:Cannot read property 'ext' of undefined

below is my datatable code,i m getting Uncaught TypeError:Cannot read property 'ext' of undefined

prasmowprasmow Posts: 2Questions: 1Answers: 0
edited June 2017 in Free community support
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Column Selector</title>
<script type="text/javascript" src="//code.jquery.com/jquery-1.12.4.js"></script> 
<script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/pdfmake.min.js"></script>
<script type="text/javascript" src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/vfs_fonts.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/buttons/1.3.1/js/buttons.colVis.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<script type="text/javascript">
    $(document).ready(function() 
    {
        var url = './findAllStoppageReport';
        var datatable = $('#example').DataTable( {
         dom: 'Bfrtip',
             buttons: [
                 'excelHtml5',
                 'csvHtml5',
                 'pdfHtml5'
             ],
           "ajax": {
            "url" : url
           },
           "columns": [
               { "data": "tripDate" },
               { "data": "tripId" },
               { "data": "location"},
               { "data": "stopStartTime"},
               { "data": "stopEndTime"},
               { "data": "totalStopTime"}
             ]
       } );
    });
</script>
</head>
<body>
    <table id="example" class="cell-border" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Date</th>
                <th>Trip Id</th>
                <th>Location</th>
                <th>Stop Start Time</th>
                <th>Stop End Time</th>
                <th>Total Stop Time</th>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
</body>
</html>

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    where are your javascript CDNs? jQuery, DataTables, DataTable buttons and so on.

  • allanallan Posts: 63,258Questions: 1Answers: 10,421 Site admin

    They were being stripped out by the forum since syntax highlighting wasn't being used. I've added it now.

    Can you show us what the ./findAllStoppageReport' script returns please?

    Can you also copy and paste the error shown in the browser's console. It would be great if you could link to the page showing the issue.

    Allan

  • prasmowprasmow Posts: 2Questions: 1Answers: 0
    edited June 2017

    ./findAllStoppageReport' is the url that returns the json,when i removed the
    dom: 'Bfrtip',
    buttons: [
    'excelHtml5',
    'csvHtml5',
    'pdfHtml5'
    ],

    code it works fine,but whenever i m adding this buttons code it's giving me the error...please help me in this..

  • allanallan Posts: 63,258Questions: 1Answers: 10,421 Site admin

    Can you show me the JSON that is returning please?

    please help me in this..

    Happy to do so. Give me a link to the page and I'll take a look into the issue.

    Allan

This discussion has been closed.