Implementing DataTables into a site hosted through BlogSpot

Implementing DataTables into a site hosted through BlogSpot

WrathOf314WrathOf314 Posts: 2Questions: 1Answers: 0
edited November 2016 in Free community support

Hi,

I've been trying to get something to work for essentially weeks now to no avail. I work for a Gaming Website called Chalgyr's Game Room in which we are using DataTables in order to provide a database of all of our published reviews and previews (http://www.chalgyr.com/p/review-library.html). This page works just fine (debugger: ofutac), and the DataTables themselves are awesome.

We are planning on moving templates though the newer one is much more jQuery heavy (http://cgrtest40.blogspot.ca/p/reviews-and-previews.html) and I'm not sure how to get the DataTables to initialize. I've gone bit by bit, I've copied the code in as a whole, I've referenced the CDNs, and I'm just not sure what's getting in the way as I've tried to place the CDN or the code in multiple different areas. I've moved all DataTable references back to (http://cgrtest40.blogspot.ca/p/reviews-and-previews.html) in the meantime like they are on the main site.

I ran the debugger for the test site and it tells me

DataTables debug bookmarklet
DataTables is not available on this page.

Any help would be greatly appreciated.

Thank You!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin

    The problem is that you are including jQuery twice on the page. Once when you include DataTables and another time inline at the bottom of the HTML page.

    The second one will overwrite the first, erasing any plug-ins that have already been loaded. That is unfortunately just how jQuery works.

    The solution is to only load jQuery once.

    Allan

  • WrathOf314WrathOf314 Posts: 2Questions: 1Answers: 0

    Hi Allan,

    I was worried that was the case but I wasn't sure how to get around it.

    I've tried two separate approaches:
    - The first is that I had removed any of the CDN references from the page itself and put them into the template. This didn't seem to do anything.
    - The second thing that I tried was the other option for the Download and downloaded a package in order to paste into the template. This either has seemed to work.

    My next question is... do the DataTables have a jQuery of their own on top of the possibility to select either the 2.x or 1.x in the download menu? I tried simply replacing the 1.11.3 that the template uses but then it ceases to function. I'm wondering if there is still another jQuery being called that is interfering? Or did I miss something while copying in both the .js and .css files?

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin
    Answer ✓

    The way I would suggest trying to do it, is to load DataTables (without jQuery) after the jQuery that is already on your page.

    Exactly how you do that on Blogspot, I have no idea! I'm assuming that the inline jQuery is something they include by default, but I'm not sure.

    Allan

This discussion has been closed.