17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1029 Views |
-
Colour up rows with setHighlightConditions

12 August 2008 at 10:48am
Hi all,
Trying to colour up some rows.
Let's say that we have the following has_many relation between employer and employee.
I want to show a has many table with all the employees and colour up those who are employed by the employer which we are working with in the CMSCan anyone help me with this code?
class employee exteds DataObject {
$has_one = array (
'MyEmployer' => 'EmployerPage'
)
}class EmployerPage exteds Page {
$has_many = array (
'Employees' => 'Employee'
)
$MyTable = new HasManyComplexTableField(
$this,
'Employees',
'Employee',
array(
'Name' => 'Name_label',
),
'getCMSFields_forPopup'
);//Hightlighting
$MyTable ->setHighlightConditions(array(
array(
'rule' => '$this->ID == $MyEmployerID', //think the problem is that $this->ID don't gets the proper value when evaluated ?¿?¿
'class' => 'orange'
)
));
}Thanks a lot.
-
Re: Colour up rows with setHighlightConditions

14 August 2008 at 10:57pm
the highlight conditions are run through PHP's eval() function. in this case you're not in the original $this context, so $this->ID would resolve to TableListField isntead of your Employee class.
How about:$MyTable ->setHighlightConditions(array(
array(
'rule' => $this->ID . ' == $MyEmployerID',
'class' => 'orange'
)
)); -
Re: Colour up rows with setHighlightConditions

15 August 2008 at 6:05am
Ohhh, that simple!!!
Thanks a lot Ingo, I always get confused with the quotation and eval string.
| 1029 Views | ||
|
Page:
1
|
Go to Top |


