adding total to Block "after_related_transactions_records_list"

30 views
Skip to first unread message

air drummer

unread,
Sep 9, 2020, 3:30:58 PM9/9/20
to Xataface
i have an account record that has a related list of transactions for which i'd like to show the total amount. debug shows the
Block "after_related_transactions_records_list"
and i've added it to my parent record's delegate class, stubbed out as

    function after_related_transactions_records_list(&$record)
    {
        echo "<div>total=</div>";
    }

but nothing shows...can i buy a clue, please, steve?-)

air drummer

unread,
Sep 9, 2020, 5:22:21 PM9/9/20
to Xataface
btw, i do calculate totals in the transactions table's delegate:
`    function renderRowFooterTemplate()
    {
        $resultSet = Dataface_Application::getInstance()->getResultSet();
        $totals = $resultSet->loadTotals(array('Amount#sum'));
        return '<tr class="template">'
               .'<th class="label">Total</th>'
               .'<td data-column="Amount">'
                  .df_escape($totals['Amount_SUM'])
               .'</td></tr>';
    }'
which works but of course only for that table.

airdrummer

unread,
Feb 24, 2021, 9:26:18 AMFeb 24
to Xataface
i'm still researching this, and have found dox mentioning "available blocks":

  • Dataface_Related_Records_List.html:after_related_`$ENV.relationship`_records_list

and "available slots":

  • Dataface_Related_Records_List.html:related_`$ENV.relationship`_records_list
  • Dataface_Related_Records_List.html:related_records_list
  • Dataface_Related_Records_List.html:after_related_list

so what's the diff between slots & blocks?

airdrummer

unread,
Feb 25, 2021, 10:22:25 AMFeb 25
to Xataface
renderRowFooterTemplate & loadTotals were noted in https://groups.google.com/g/xataface/c/QOHTFBDEwRM/m/JksX4wf0DEcJ but the dox url 404s

airdrummer

unread,
Feb 26, 2021, 8:58:30 AMFeb 26
to Xataface

airdrummer

unread,
Feb 26, 2021, 2:10:12 PMFeb 26
to Xataface
i've added echo to my after_related_transactions_records_list function in the table delegate.php but nothing appears...evidently it's not getting called:-\


airdrummer

unread,
Mar 4, 2021, 9:01:30 AMMar 4
to Xataface
i've pretty much given up on totalling the related_transactions_records_list, so i added an action to display the total separately via another view, which works, but i don't want to see c.r.u.d. for that r.r. so i added this to my class delegate:
<pre>function rel_balances__permissions(&$record)
    {
            return array(
                'add new related record'=>0,
                'add existing related record'=>0,
                'remove related record'=>0,
                'delete related record'=>0
            );
    }
</pre>
but the add new link & delete selected still appear...so what's the majick incantation?-) or is it simply that embedding my business logic in views rather than coding it into relationships.ini is getting in the way of xataface?

airdrummer

unread,
Mar 4, 2021, 9:06:31 AMMar 4
to Xataface
i forgot to mention that actually performing the unwanted actions results in failure, so not a show stopper, just curious...the 2 actions result in different failure handling:

add new r.r.:

Internal Server Error
Check your error log for details.
db717943-5779-479d-abbc-d322e8cc3af8

delete selected:
  • Failed to delete record 'Untitled Balances Record' because of an SQL error: '' : 'DELETE FROM `balances` WHERE `balances`.`AccountID` = '127''
which is expected as it's a view, not a table.

Reply all
Reply to author
Forward
0 new messages