1–9 of 9 Page: 1 | |||||||
|---|---|---|---|---|---|---|---|
SKU![]() | Name![]() | Price (USD) ![]() | Incl. sales tax (USD) ![]() | In stock?![]() | Units in stock![]() | ![]() | ![]() |
| PE198 | Component | $99.95 | $114.94 | Yes | 89 | ||
| AL405 | Contraption | $12.99 | $14.94 | Yes | 32 | ||
| AL406 | Contrivance | $89.00 | $102.35 | Yes | 987 | ||
| QR540 | Device | $1,029.00 | $1,183.35 | Yes | 154 | ||
| PE1021 | Gadget | $8.50 | $9.77 | Yes | 673 | ||
| QR562/4 | Gizmo | $2.50 | $2.88 | No | 0 | ||
| XR2003 | Model | $1,499.00 | $1,723.85 | Yes | 4 | ||
| PE556 | Part | $0.10 | $0.11 | No | 0 | ||
| PE349 | Widget | $10.99 | $12.64 | Yes | 1645 | ||
1–9 of 9 Page: 1 | |||||||
This example demonstrates the use of expressions to control the appearance of columns. Expressions may be used to change the way data in a column is represented. They are not quite the same as calculated columns, as the data will still be sorted according to the original (no longer visible) values. If you want a calculated column (for example, the product of two other columns) the best place to do this is in your database query. Let's look at the expressions in use here:
expression="lsCurrencyFormat(value * 1.15)".type="boolean".expression="iif(value lt 50,de(""<span style='color : red; font-weight : bold'>"" & value & ""</span>""),value)". This expression relies on the ColdFusion iif() function to evaluate a boolean expression (value lt 50). If the expression is true, then the second attribute of iif() is evaluated; if false, then the third attribute is evaluated. We don't want ColdFusion to evaluate some portions as they are HTML, so we wrap them in the de() function.This example also demonstrates setting up several different links for each record. Instead of supplying a link attribute on the cf_sorTable tag, we add it to individual cf_column tags.