WordPress.org

Ready to get started?Download WordPress

Forums

WP-Table Reloaded
[resolved] Calculate Table Row data through Checkboxes (9 posts)

  1. schniffer
    Member
    Posted 1 year ago #

    This might be out of the plugin scope but please enlighten with some guide on how to implement this on a certain table in my site.

    I've created this table http://a3ger.freehosting.com/table-2/ with the checkboxes on the first column. What I want to accomplish is create a certain button that will calculate the total number of checked titles, the total number of episodes and total file size of the selected titles.

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

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    yes, unfortunately, this is indeed out of scope of the plugin, as this is basically just a question about the implementation of some JavaScript code.

    My suggestion for this is to use the jQuery library, use it to select all checkboxes, then loop through all checkboxes and find their parent table row (<tr>). That gives you all selected table rows. Finally, you can loop through these and select the corresponding cells and sum their numerical values.
    A good starting point for this might a jQuery tutorial like http://jqfundamentals.com/

    Regards,
    Tobias

  3. schniffer
    Member
    Posted 1 year ago #

    Hello,

    Well for five hours before I have received your reply, I've found out that this can be implemented by the use of jQuery and DataTables plugin. I've also found some examples on having clicked the checkboxes, multiple number of rows can be selected and highlighted.

    Then I've read guides on how to to apply the datatables plugin on my table created by the WP-Table-Reloaded plugin.

    As a matter of fact, I've finally managed to make it work by (base on what I've read)
    -disabling the datatables library
    -disabling the default css stylesheet of the plugin
    done by unchecking the boxes on the Plugin Options
    -then adding the css class display on the Table Styling Options of that certain table

    and here is the table

    As per your suggestion, I will certainly read that later once I managed to apply the highlight feature by selecting multiple check boxes.

    Before I forgot, thanks for your reply, this plugin is simply the best!

    P.S. If you have certain knowledge on the feature which I mentioned above, please feel free to guide me.

    Thanks.

  4. schniffer
    Member
    Posted 1 year ago #

    The dataTables library plugin is now really working,

    I can't seem to make my table look like the one in this page until I saw the jquery library checkbox feature included in thesis theme.

    I think it conflicted with this code that I added using the HiFi plugin.

    <script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>

    Now it works like a charm.

  5. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    great to see that you are making progress with this! :-)
    For the handling of the checkboxes, you will now just need to add that additional JavaScript.

    Best wishes,
    Tobias

  6. wpjohnny
    Member
    Posted 1 year ago #

    Hey guys,
    I need to make a form that collects inputs & makes some calculations that will have a search that will find the corresponding variations of part numbers and products of the calculation results. Could anyone point me in the right direction? Is there a WP plugin that can be manipulated to do this?

  7. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    unfortunately, I don't really know a solution to this :-(

    Your best chance might be some custom programming: Create a database table with your data. Create a form that submits the values to a PHP script, do the calculations in PHP, and query the database table for the relevant entries, and show those on the page.

    Regards,
    Tobias

  8. wpjohnny
    Member
    Posted 1 year ago #

    Thank you TobiasBg

  9. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    sure, no problem!

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic