DataTables not loading with site

DataTables not loading with site

kr0401kr0401 Posts: 3Questions: 2Answers: 0
edited September 2021 in Free community support

I have a site and I call dataTables from a local server but for some reason it is not loading. I have tested the location on the local server with another project and it works there so I'm not sure why it isn't here. I have attached a snippet of my HTML.

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>My Project</title>
<style type="text/css">
td#td-1 { background:#F0FFF0;}
td#td-2 { background:#FCFFD3;}
td#td-3 { background:#F6D8DC;}
td#td-gr { background:grey;}
td#td-r{ text-align:right;}
td#td-l{ text-align:left;}
td#td-c{ text-align:center;}
tfoot input {
width: 100%;
padding: 3px;
box-sizing: border-box;
}
.dataTables_wrapper .dataTables_filter {
float: right;
text-align: right;
visibility: hidden;
}
</style>
<script type="text/javascript" charset="utf8" src="http://my.local.server/.js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" charset="utf8" src="http://my.local.server/.js/dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://my.local.server/.css/dataTables.css"/>
</head>
...
...
<script>
$(document).ready( function () {
$('#table_untrim tfoot tr').insertBefore($('#table_untrim tbody'));
var utrimtable = $('#table_untrim').DataTable( {
'pagingType': 'full_numbers',
'paging': true,
"lengthMenu" : [ [-1, 10, 25, 50, 100], ["All", 10, 25, 50,100] ]
});
</script>

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,771

    I have a site and I call dataTables from a local server but for some reason it is not loading

    What exactly is not loading?

    What troubleshooting have you done? Do you get errors in the browsers console?

    How are you loading the data into the table - its not clear from the code snippet.

    Can you post a link to your page or a test case replicating the issues so we can help debug?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • kr0401kr0401 Posts: 3Questions: 2Answers: 0

    None of it loads, like the drop-down menu, page numbers, search bar, etc.

    The error I'm getting in the browser console is this:
    Uncaught TypeError: Cannot set properties of undefined (setting '_DT_CellIndex')

    Data is loaded into the table through a perl script.

    I can't post the page due to it containing confidential medical data

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,771
    Answer ✓

    Uncaught TypeError: Cannot set properties of undefined (setting '_DT_CellIndex')

    There are a lot of threads, like this one that discuss the error. Generally its due to a mismatch in the number of columns in HTML and what is defined for Datatables.

    I would start by making sure the HTML table matches the Datatables HTML requirements. Make sure you don't have -tag rowspanor-tag colspanin the-tag tbody`.

    Kevin

Sign In or Register to comment.