MaxDB PHP Generator online Help
Prev | Return to chapter overview | Next |
OnCustomRenderTotals
This event occurs before total values rendering and allows you to replace the default total footer content. To use it, enable the grid footer in the View properties of the corresponding column.
Signature:
function OnCustomRenderTotals ($totalValue, $aggregate, $columnName,
&$customText, &$handled)
Parameters:
$totalValue |
The value of currently processed total. |
$aggregate |
The string representation of total aggregate ('AVG', 'SUM', 'MIN', 'MAX', 'COUNT'). |
$columnName |
The column name of currently processed total. |
$customText |
A string to replace the total cell content. |
$handled |
A parameter to indicate whether the event handler executed. Set $handled to true in the event handler to apply new content. |
Example 1:
The code below changes the caption of the 'amount' column footer and gives it strong importance.
if ($columnName == 'amount')
{
$customText = '<strong>Total: $' . $totalValue . '</strong>';
$handled = true;
}
This picture demonstrates the difference between a webpage generated with default footer and a webpage with the OnCuStomRenderTotals event specified in this way:
Example 2:
The code below is used in our online demo on the 'Teams' page to display the year of foundation of the oldest team on the page in more convenient form.
if ($columnName == 'year_founded') {
$customText = 'MIN: ' . intval(str_replace(',', '', $totalValue));
$handled = true;
}
Prev | Return to chapter overview | Next |