Installed Datatables on WP site. No errors, everything appears correct but no datatables...

Installed Datatables on WP site. No errors, everything appears correct but no datatables...

trustedsamuraitrustedsamurai Posts: 9Questions: 4Answers: 0

Sorry for the weird subject/question.

http://tma.fortewebdesign.com.au/publications/

I've written some PHP to create a table. I've made sure to include <thead> and <tbody> . I've also thrown in <tfoot> for good measure.

The table has the following id and class, as per the instructions.
<table id="table_id" class="display">

I have downloaded the necessary files (I think) and saved them to ../wp-content/Datatables/*

I have included the default script and style load as follows, changing the path to suit.

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

I have also included in the above javascript the following default starter script.

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

But nothing happens. No errors in console.

Inspect/Sources shows the path to the DataTables folder.

Any ideas what I'm doing wrong?

Thank you very much for any offers of assistance. I'm sure its something really stupid, but I've been going over this for hours. Will try again tomorrow.

Cheers,

John.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    edited May 2018 Answer ✓

    Hi John,

    I just initialised the DataTable on your page with

    table = jQuery('#table_id').DataTable()
    

    See the attached screenshot:

    So there may be a conflict with the $ - see this StackOverflow thread.

    Hope that helps,

    Cheers,

    Colin

  • trustedsamuraitrustedsamurai Posts: 9Questions: 4Answers: 0

    Hi Colin,

    Yes that resolved the issue.

    Thank you so much for your response and the link to stack overflow.

    Cheers,

    John.

This discussion has been closed.