Unable to get a new installation to work

Unable to get a new installation to work

measterbrookmeasterbrook Posts: 14Questions: 5Answers: 0

I am using ASP.Net MVC 5 and I'm not able to get DataTables to work. I have a regular HTML table and am using version 1.11.3 of DataTables. I am using jQuery 3.6.0.

At the top of the page I have:

<script src="~/jQuery-3.6.0/jQuery-3.6.0"></script>
<link rel="stylesheet" type="text/css" href="/DataTables/datatables.css"> 
<script type="text/javascript" charset="utf8" src="/DataTables-1.11.3/datatables.js"></script>

And I have the script file at the bottom of the page:

<script src="~/Views/IndexFooter/IndexFooter.js"></script>

The script file is:

$(document).ready( function () {
    $('#indexTable').DataTable();
} );

When I open the HTML page, it doesn't look or function any differently.

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    The code snippets look good. Its hard to say what the problem is without seeing it.

    Do you get errors in the browser's console?

    Is the id of the table indexTable? Its case sensitive.

    Have you used the browser's debugger to make sure your last code snippet is executed?

    If this doesn't help please provide a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • measterbrookmeasterbrook Posts: 14Questions: 5Answers: 0

    I have been using DataTables with regular HTML for several years with no problems. This is my first try using it with ASP.Net.

  • measterbrookmeasterbrook Posts: 14Questions: 5Answers: 0

    And yes the table id is "indexTable"

  • measterbrookmeasterbrook Posts: 14Questions: 5Answers: 0

    The problem was that the layout file for the page had a second call for jQuery:

    <script src="~/lib/jquery/dist/jquery.min.js"></script>

    I commented it out and now it works.

Sign In or Register to comment.