onRender example
Suppose you’re printing a list of test scores, grouped by age. You have a headerBand that prints in every StreamFrame. After printing in the first StreamFrame, you want it to add the word "continued". Every time a new group starts, you want to remove the word. There is also a footerBand to print totals for the group.
You create an Text object with the following expression codeblock as its text property:
{||"Age: " + this.parent.parent.parent.rowset.fields["Age"].value}
In the component’s onRender event, you change the codeblock to include the word "continued":
function header1_html1_onRender( )
this.text = {||"Age: " + this.parent.parent.parent.rowset.fields["Age"].value + " continued"}
So now, once it is rendered at the beginning of the group, it is changed so that it will contain the word "continued" for the rest of the group.
To change it back for the start of a new group, use the following onRender event handler for the Text component in the footerBand:
function footer1_html1_onRender( )
this.text = {||"Age: " + this.parent.parent.parent.rowset.fields["Age"].value}
This restores the original codeblock at the end of the group, preparing the Text component for the beginning of the next group.