BeforeSummarySectionRender Event

Description

This event allows you to dynamically set the inline style property for summary values. For example, you can display a 'total' in red if it is above a certain value or in green if it is below a certain value.

Discussion

This event fires if a Grid has summary fields. It is fired before the Summary Section row in rendered.

The following variables are available to you in the event:

Variable
Description
e.tmpl

The grid component definition

e.rtc

Used to store run time calculations that can be used by other server-side events. You can put any data in this variable that you want to pass to other events. e.g. e.rtc.mydata = 'value1'

e.summaryValues

Summary values for the fields for which summary calculations were defined.

e.summaryStyle

Inline style for each summary value, as defined in the Grid properties. The purpose of this event is to modify the inline style for any of the summary fields.

Examples 

Example summary values in e (assuming you requested summary calculations for the QUANTITY field):

e.summaryValues.QUANTITY.Count
e.summaryValues.QUANTITY.Min
e.summaryValues.QUANTITY.Max
e.summaryValues.QUANTITY.First
e.summaryValues.QUANTITY.Last
e.summaryValues.QUANTITY.Total
e.summaryValues.QUANTITY.Average
e.summaryValues.QUANTITY.Var
e.summaryValues.QUANTITY.StdDev

Example summaryStyle values in e:

e.summaryStyle.QUANTITY.Count = "text-align:right;"
e.summaryStyle.QUANTITY.Total = "text-align:right;"

This example code sets the in-line style for the 'Total' value for the 'Quantity' field:

if e.summaryValues.QUANTITY.Total < 10 then
    e.summaryStyle.QUANTITY.Total = a5_CSS_Combine(e.summaryStyle.QUANTITY.Total,"color: red;")
else if e.summaryValues.QUANTITY.Total >= 10 .and. e.summaryValues.QUANTITY.Total < 20 then
    e.summaryStyle.QUANTITY.Total = a5_CSS_Combine(e.summaryStyle.QUANTITY.Total,"color: blue;")
else
    e.summaryStyle.QUANTITY.Total = a5_CSS_Combine(e.summaryStyle.QUANTITY.Total,"color: green")
end if
The a5_CSS_Combine() function combines to in-line style definitions. For example, if the in-line style was set in the builder to "text-align: right;" and you add in "color:red;" the combined style is: "text-align:right; color:red;"

Setting State Variables 

You can also set state variables in this event. The value of any state variables will be available in all subsequent ajax callbacks (in the e.__si2 object).

To set a state variable:

e._state.myvar1 = "value1"
e._state.myvar2 = "value2"