Set the color of rows in the grid dynamically Default: If the first character is = then the rest of the line is evaluated as PHP code. The default rowColorLens can be seen in the syntax example below:
The following example highlights the selected row, and all those below the selected row:
$lens->rowColorLens = '={_RECNO_}>={_HILITE_RECNO_} ? "#FFCCCC" : "" ';
where {_RECNO_} is the current row, and {_HILITE_RECNO_} is the selected or highlighted record number.
This is not particularly useful. The following is the actual rowColorLens used by phpLens:
$lens->rowColorLens=
'=LensRowColor("#FF8080",{_LENSID_},{_RECNO_},'.
'{_RECNO_}=={_HILITE_RECNO_},{_SELECTC_},{_ODDC_},{_EVENC_},{_HASDETAILS_},{_URLPARAMS_})';
To change the default select color from pink, change the #FF8080 above.
You can also use column names. For example, to highlight all negative prices in pink:
$lens->rowColorLens = '={PRICE}<0? "#FFCCCC" : "" ';
If you do not prefix this property with equals, the string will be treated as HTML and not PHP code as in the powerLens property.
Variable List
{_LENSID_} The $lens->id
{_RECNO_} The current record number
{_HILITE_RECNO_} The record number that is currently selected
{_SELECTC_} The select color for selected record, eg #800000 for red
{_ODDC_} The odd line color (from $lang->oddColor)
{_EVENC_}The evenline color (from $lang->evenColor)
{_HASDETAILS_} 1 if $lens->showDetails is true, 0 if false
{_URLPARAMS_} is the value of the urlParams property. Added in 3.5.2.Syntax
# The source code for LensRowsColor() is in phplens.inc.php
$lens->rowColorLens=
'=LensRowColor("#FF8080",{_LENSID_},{_RECNO_},'.
'{_RECNO_}=={_HILITE_RECNO_},{_SELECTC_},{_ODDC_},{_EVENC_},{_HASDETAILS_},{_URLPARAMS_})'; Basic:Yes Advanced/Enterprise:Yes DynamicEdit:Yes [Version 1.2]
|