Dynamic View Services > Specifying Dynamic View Types > View Parameters > Row Color and Cost Threshold
 
Row Color and Cost Threshold
For instance, if you want the color of each row in the DepartmentTable to depend on the monthly cost of the corresponding employee and on two thresholds (lowCost, highCost) specified as parameters of the view type, you can write the following code:
view DepartmentTable(int lowCost=0,
          int highCost=100000):
...
subscribe Employee:
represent RowR row:
Ref<TableR> owner=department->table;
string column[1]=name;
string column[2]=monthCost;
string color=(monthCost<=view.lowCost)
? "blue"
: (monthCost<view.highCost)
   ? "green"
   : "yellow";
View parameters are accessed like runtime attributes of the view. Each view parameter must be specified with a default value, which can be modified in three ways:
*By setting the parameters used at the opening of the view: an example is given below with the function TreeItem::onSelection.
*By using the function IlsMvView::setParamValue (see the Rogue Wave® Server Reference Manual for a detailed description)
*By mapping your view parameters to representation attributes: when these attributes are edited by the component, the modifications are notified to the server, which in turn updates the view parameters

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.