WordPress.org

Forums

[resolved] JavaScript Library Not Working for WP-Table Reloaded (21 posts)

  1. ajcke
    Member
    Posted 4 years ago #

    I have JavaScript libary enabled and set to DataTables for WP-Table Reloaded, and sorting and pagination enabled for my table.

    This worked fine until I updated to version 3.0.1 a few months ago.

    The table displays on the webpage as a static table. The sorting and pagination options have disapeared.

    Any suggestions?

  2. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    can you provide a link to your page with the table?

    Have you changed your theme since you saw it working the last time?
    Have you installed any plugins that use JavaScript?

    Tobias

  3. ajcke
    Member
    Posted 4 years ago #

    Here's the link: http://hardinnorthern.org/?page_id=914

    I have not changed my theme or messed with any of the backend of my theme since it last worked.

    Below are a list of all my plugins that are active. I have other plugins installed that aren't active. Could a plugin that is installed and not active cause an issue? I'm pretty sure all of these were installed and active prior to wp-table reloaded not functioning 100%. I'm not sure which ones use JavaScript. Could any of these cause issues? I'm very confident that table reloaded stopped functioning when I upgraded the site from the latest version of MU to 3.0.1. It could be a plugin issue, but I'm not sure how to track it down.

    BM Custom Login
    Contact Form 7
    Flash Video Player
    NextGEN Gallery
    PJW Mime Config
    Podcasting Plugin by TSG
    Redirect
    Reviionary
    Role Scoper
    Role Scoping for NextGen Gallery
    SI Captcha Anti-Spam
    TynyMCE Advanced
    User Photo
    Wordpress.com Stats

  4. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    thanks for the link and the plugin list.

    The plugins should all be fine, I don't know of conflicts with them. Installed but deactivated plugins can not cause conflicts, as nothing from them is loaded.

    Anyway, the problem is rather simple: The necessary JavaScript libraries are not included into the page. This likely is, because your theme's footer.php does not contain a call to <?php wp_footer(); ?>.
    It should be located right before the closing </body> tag there.
    Can you check that and insert it, if it is missing?

    Regards,
    Tobias

  5. ajcke
    Member
    Posted 4 years ago #

    You're the man! That fixed it. I'm thinking I had to take that out at one time during my upgrade to WP 3.0.1 to fix another issue, but I can't remember what that was.

  6. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    no problem :-)

    The wp_footer(); call is necessary to give plugins a chance to insert code into the page, so you should not remove it, but rather fix the plugin which was creating that other issue back then.

    Best wishes,
    Tobias

  7. kristarella
    Member
    Posted 4 years ago #

    Hi Tobias,

    I'm also having a problem with the javascript libraries not being loaded on the page, but I definitely have wp_footer(); in the theme: I can hook into it and add stuff to it from my functions file.

    I'm using Wp-Table Reloaded 1.8 and WP 3.0.4.

    I can't really give you a link to the site because it's not public yet, and most of the content will be members only, but I hope you can point me in the direction of things to look at.

    The other plugins activates are:
    AVH Extended Category widgets
    Cforms
    Event Calendar / Scheduler
    Mingle
    Poll Daddy Polls
    Shadowbox JS
    Simple:Press
    Social Media Widget
    Tooltip Glossary
    Wenderhost Subpages Widget
    Widget Logic
    Wishlist Member
    WordPress.com Stats

    But I don't see how they would cause the javascripts not to load... only cause js conflicts after they've loaded.

    Hope you can help me. Thanks!

  8. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    hhhm, without the site to look at this is really hard to debug unfortunately :-(

    Please check the following: Is the plugin's JavaScript loading call included in the resulting page output (i.e. are there <script> tags to the DataTables library in the page's HTML code)?

    If yes, are the files all accessible from the web or do you maybe get an error message when manually trying to load the file in your browser?

    Also, is jQuery loaded properly in the page's HTML code?

    You could also temporarily switch to the WordPress Default Theme to see if things work there (just to make sure that it is not a theme issue).

    Regards,
    Tobias

  9. kristarella
    Member
    Posted 4 years ago #

    Thanks for your prompt reply Tobias!

    I think the problem was that jQuery and UI were being called twice on the page... I'm not sure if that is known to cause errors, but I stopped that from happening and the sorting seems to be working.

    Thanks!

  10. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    thanks for your further investigations!
    That definitely could be the reason for those issues, as I have heard about the problem of jQuery being loaded twice before. Basically, what happens is that the second copy removes stuff that the first one had created.

    So, good to hear that this is now working!

    Best wishes,
    Tobias

  11. OtaQ
    Member
    Posted 4 years ago #

    Oh great, I got it... as you wrote:

    The <?php wp_footer(); ?> should be located right (!!!) before the closing </body> tag there.

    Had it in before, but not RIGHT BEFORE the </body>

  12. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    great that you found the problem. I guess that this solves your question in http://wordpress.org/support/topic/plugin-wp-table-reloaded-cant-activate-datatables as well.

    Regards,
    Tobias

  13. Mike_ox
    Member
    Posted 4 years ago #

    Hi

    I can only get the sort function to work using the tablesorter library.

    I really want the search and Pagination functions. I've changed the library to DataTables+TableTools and tried the defualt DataTables and selected the relevent option in the table editor but nothing works.

    If I can get my table workking like the demo table on this site: http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/
    That would be awesome

    My theme does have <?php wp_footer(); ?> in the footer right before </body>.

    The plugins I have active are:
    Fast Secure Contact Form
    Contact Form to DB Extension
    HeadSpace2
    W3 Total Cache
    WP-Table Reloaded

    Anyone know why This isn't working?
    Thanks
    Mike

  14. Mike_ox
    Member
    Posted 4 years ago #

    Ah it seems it doesn't work in firefox and that's the problem

  15. kristarella
    Member
    Posted 4 years ago #

    Mike --- I had some troubles with the datatables javascript and W3 Total Cache when javascript minification was on. I had to play around with the minification settings a bit, including only having the first setting checked (so not removing line breaks etc). And if you do have javascript minification on, you might need to reorder the way the files are compressed into one file so that any files that are dependent on other files come after the files they're dependent on.

    Also, if you're using Firefox with Firebug installed, or Chrome, or Safari you can right click on the page and select "Inspect Element". If there are any errors on the page a red number with a little cross icon will show up at the bottom right of the firebug or inspection window. If you click on that number it should bring up a list of the errors and that may indicate whether there's a javascript error affecting the page.

  16. TobiasBg
    Member
    Posted 4 years ago #

    Hi,

    kristarella, those are very good hints for Mike, thanks for posting them!

    Mike, if you still can't get it to work with those ideas, please post the link to the page with your table, so that we can take a look at it and maybe find the cause for the issue.

    Thanks,
    Tobias

  17. Mike_ox
    Member
    Posted 4 years ago #

    Hi

    Thanks for your quick replies. I ended up installing the basic theme to see if it would work on that as I've edited mine.

    It didn't. I realised it was a simple case of not working on firefox, or at least my version of firefox (4.0.1). It works on IE and Chrome.

    I love the search function. I need the table filterable on 4 criteria though. So in a separate question I'm trying to get a filter grid along the top of a table.

    I'm looking at this code...

    <script language="javascript" type="text/javascript">
    //<![CDATA[
    setFilterGrid("table1");
    //]]>
    </script>

    Am I on the right tracks? I'm struggling

    Thanks again for your help
    Mike

  18. TobiasBg
    Member
    Posted 4 years ago #

    Hi Mike,

    unfortunately, I don't recognize the code that you have posted, as it is not part of WP-Table Reloaded or the DataTables JavaScript library. I assume that you have from some other plugin?

    And to fix that problem with Firefox, please provide the URL to the page with your table.

    Regards,
    Tobias

  19. Mike_ox
    Member
    Posted 4 years ago #

    Hi

    Here's the url
    http://www.bandsforgigs.co.uk/the-band-database

    It works on chrome and IE

    The code I put up is from: http://www.javascriptkit.com/script/script2/tablefilter.shtml

    as I'm trying to make a table dynamically filterable on 4 columns.

    Mike

  20. TobiasBg
    Member
    Posted 4 years ago #

    Hi Mike,

    thanks for the link.
    I can confirm, that the DataTables features are not working in Firefox, but I have no idea why :-(
    I suggest that you try asking in the DataTables forums at http://www.datatables.net/forums, as the developer might be able to help.

    Unfortunately, I also don't know if that tablefilter script can be used together with DataTables. That might be something that you could also ask there.
    To then include the script, you will need to load a JavaScript file into the page's header and then that code that you already posted, but with a changed class name in it.

    Best wishes,
    Tobias

  21. Mike_ox
    Member
    Posted 4 years ago #

    Well thanks for your help and quick replies

Topic Closed

This topic has been closed to new replies.

About this Topic