WordPress.org

Forums

WP-Table Reloaded
[resolved] Datatable integration (17 posts)

  1. Hockeyguy1925
    Member
    Posted 3 years ago #

    Tobias,
    After a month or so reading a digging into your plugin I have finally made it work as best for me as it possibly can.

    One thing remains on plate.
    I have a list of hockey players in table. With the help of datatables scripts, I want my site visitors be able to click on a player(or a button beside players name) and have info about the player (such as goals jersey number etc)to slide open (hide/show).

    Im not sure if you know the script so I will send you to this
    http://datatables.net/release-datatables/examples/api/row_details.html

    Where do I put this code to initialize it? And for safety sake, what parts dont I edit for fear of screwing things within the code up?

    Thanks

    http://wordpress.org/extend/plugins/wp-table-reloaded/

  2. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    thanks for your question.

    For that, the best way would be to disable the usage of the DataTables JavaScript library within WP-Table Reloaded for your table and then manually load everything into the page. You could use a page template for this, for example, into which you would need to paste the initialization code for the library and the code that then open/closes the details.
    In that scenario, WP-Table Reloaded would only be used to generate the HTML code for the table.

    (For some implementation details (on a different feature though), please take a look at http://wordpress.org/support/topic/plugin-wp-table-reloaded-datatables-reloaded-with-collapsibleexpandable-grouping . This should help for your plans as well.)

    Regards,
    Tobias

  3. Hockeyguy1925
    Member
    Posted 3 years ago #

    Hi Tobias
    Thanks for very quick response. Just curious what you mean by "manually load" everything into page?
    Thanks HG

  4. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    with that I basically mean that it is better to not let WP-Table Reloaded do the loading and initialization of the DataTables library, but to do it with some custom code (like in the instructions in my link above) in the post/page.
    That way is much more flexible when it comes to customizing the JavaScript calls, or to extending the calls with special features like those from your link from the DataTables website.

    Regards,
    Tobias

  5. Hockeyguy1925
    Member
    Posted 3 years ago #

    Thanks again Tobias,
    This is surely going to take some practice as I am very new to this.
    Excuse my ignorance as there may be a few dumb questions in the coming days:)

  6. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    no problem, we've all started at some point :-)
    But I'm confident that you can get a good start by following those tutorials in my link.

    Best wishes,
    Tobias

  7. Hockeyguy1925
    Member
    Posted 3 years ago #

    Im just confused as to where all of the code is supposed to go. I disabled the javascript from tables reloaded as stated above. Created a template. That's as far as I can get, before my mind gets boggled.
    to get a better understanding...

    I have a players page, with table id on it to load the table when the page is clicked on...works fine. when I go to datatables website to get the code for the hide/close script....where do I put that code? template? or page? what do I have to edit in code to get that to work? I dont want you to do it for me...just a bit more guidance. where does HTML code generated by reloaded go?

    Told ya, dumb questions:)

  8. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    you won't have to change the HTML code from WP-Table Reloaded, you will just need to add the JavaScript code. As a start, I suggest to take a look at where WP-Table Reloaded echoes that code, by using "View Source" in your browser on a page that has DataTables still activated. Once you see how the structure works (also explained in http://datatables.net/blog/Getting_started_with_DataTables%3A_First_steps to some extent), you should try to get DataTables invoked manually, by adding the JavaScript calls to the page template (with that, no changes to the actual page content are required), or by using the HiFi plugin.
    Once DataTables works, you can proceed to add the row_details stuff to it.

    Regards,
    Tobias

  9. Hockeyguy1925
    Member
    Posted 3 years ago #

    Tobias,
    Here is where I am at. I have created a template named goalies that I will use with goalie page. On the goalie page I have put in the script as well as short code for table. It shows up with no errors which is good. In the "getting started" page on data tables website it shows the initialization code. In that code it has a line with $('#table_id').datatable()
    Do I need to change table id to tables reloaded short code?
    Am I doing this right so far or does script have to go into template?
    Is it possible for you to set up the first one (goalie) so I can see more clearly?
    Thanks again

  10. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    all code related things need to go into the template. The page content will just be the Shortcode (and possibly surrounding text from that page of course).

    The

    $('#table_id').datatable()

    needs to be changed to

    $('#wp-table-reloaded-id-123-no-1').datatable()

    which resembles the HTML ID of the table (the 123 in that example resembles the table ID that you also use in the Shortcode).

    If you post the link to the page with your current results, I'll take a look at it.

    Regards,
    Tobias

  11. Hockeyguy1925
    Member
    Posted 3 years ago #

    Tobias,
    Please have a look at this.
    Links for download are posted
    https://dl.dropbox.com/u/61582742/goalies.htm
    https://dl.dropbox.com/u/61582742/Goalies.php

    Thanks

  12. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    thanks for the files. Unfortunately, that doesn't really help, as I can't see why it might not be working from static files.

    Can you maybe set up a test site online?

    Regards,
    Tobias

  13. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi again,

    I did notice one thing however: You are loading the DataTables JS file from a local URL (C:\...). This might cause trouble. Instead, you should change this to a URL on the local server, i.e. to something like http://localhost/... (or whatever your local server name is).

    Regards,
    Tobias

  14. Hockeyguy1925
    Member
    Posted 3 years ago #

    Hi Tobias,
    I am using wamp as local server. I will upload datatables to my host later tonight or tmr so you can see can you flip me your email so I can send you pass word to set you up as a user?

  15. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    you can find my email address in the main plugin file of WP-Table Reloaded, wp-table-reloaded.php.

    Regards,
    Tobias

  16. Hockeyguy1925
    Member
    Posted 3 years ago #

    info sent to email

  17. TobiasBg
    Member
    Plugin Author

    Posted 3 years ago #

    Hi,

    just for everybody: As this requires special work on the server, we'll be working directly via email.

    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Table Reloaded
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.