1.5

Table Of Contents
Styling based on a value in a detail table
Styling rows or cells in a detail table based on a value in the detail table goes a bit different.
First set an ID on the detail table as a whole and create a script that uses thatID tbody as the
script's selector. If for example the ID is table_1, the selector will be: #table_1 tbody. Then
write a script like the following:
for(var i = 0; i < record.tables.detail.length; i++){
if(record.tables.detail[i].fields['Shipped'] == 1)
query("tr:nth-child(" + (i+1) + ")", results).css
('color','green');
}
This script loops over a detail table, evaluating the field Shipped. If the value of that field is 1, it
looks up the corresponding row in the results (the object that contains the selected detail
table) and colors the text of that row green. (See also: "query()" on page772 and "css()" on
page745.)
To keep all CSS style rules together you could add the style rules to a class in the CSS file
(see "Styling templates with CSS files" on page454) and assign that class to the a row or cell
using addClass (see "addClass()" on page732).
For another example, see this how-to: Change detail line formatting based upon a data field
value.
Rotating elements
In any type of template, boxes, images, tables, text and other elements can be rotated.
The toolbar buttons Rotate Clockwise and Rotate Counter Clockwise rotate the element in
which the cursor is located 90 degrees at a time.
Page 483