Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your question.

    Sorry, but unfortunately I have to disappoint you 🙁 This is not possible, as the formula functionality is not sophisticated enough to recognize this. References to cells must contain the row number. So, you’ll have to update that formulam whenever you add rows.

    Regards,
    Tobias

    Thread Starter gabeheter

    (@gabeheter)

    But it can do =SUM(A2:A123) right? I might be able to do some php code stuff to get the number of rows returned and write the variable into the cell? Do you think that might be possible?

    Thread Starter gabeheter

    (@gabeheter)

    Is the math done via javascript after pageload?

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    yes, =SUM(A2:A123) is no problem.
    And yes, using PHP so fill in the number should not be a problem. The best approach for that would be to hook into the tablepress_table_raw_render_data filter hook, which receives the full table (as a two-dimension array) as its parameter (see classes/class-render.php).

    Note that this solution requires the current TablePress development version from http://tablepress.org/download/extension/tablepress-dev.zip , as this filter hook is not yet part of the current stable version.

    Another solution, which is very similar, could to use the [table-info] Shortcode (explained a little bit in the documentation at http://tablepress.org/documentation/ ). In the development version, this has received another parameter, that allows to retrieve the number of rows of a table, see http://wordpress.org/support/topic/table-info-total-number-of-rows
    If you combine that with the TablePress Extension that I briefly describe here http://wordpress.org/support/topic/calling-other-table-cell-values-from-another-table#post-3818970 , it should be possible to use a formula like

    =SUM(A2:A[table-info id=123 field="number_rows" /])

    inside a table (here table ID 123) that is loaded with the Shortcode

    [table id=123 shortcodes_before_formulas=true /]

    Regards,
    Tobias

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    and for your other question: No, the math is done in PHP, before the table HTML is created.

    Regards,
    Tobias

    Thread Starter gabeheter

    (@gabeheter)

    Thanks, Very helpful.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    sure, no problem! You are very welcome!
    I hope this information helps to get this working for you.

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Adding all rows in a column’ is closed to new replies.