我正在构建一个 ItemRenderer,以显示公司可能希望在建筑物上执行的工作列表。然后,用户可以单击作业以选择它并使用父视图上的添加/编辑/删除按钮。
如何在我的 s:ItemRenderer 中突出显示选定的 HGroup 以允许用户查看当前选择的作业?
<s:Scroller width="100%" height="70%">
<s:DataGroup width="100%" height="100%"
horizontalCenter="0" verticalCenter="0"
dataProvider="{Session.EXISTING_JOBS}"
>
<s:layout >
<s:VerticalLayout />
</s:layout>
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer verticalCenter="0" horizontalCenter="0" width="100%">
<fx:Script>
<![CDATA[
protected function jobSelect_clickHandler(event:MouseEvent):void
{
// highlight the HGroup here
if(this.selected == true){
jobRow.setStyle('contentBackgroundColor',0x000000);
} else {
jobRow.setStyle('contentBackgroundColor',0xFFFFFF);
}
}
]]>
</fx:Script>
<s:states>
<s:State name="normal"/>
</s:states>
<s:HGroup id="jobRow"
width="100%" height="50"
verticalAlign="middle"
click="jobSelect_clickHandler(event)" >
<s:Label text="{data.id}"
width="15%" height="50"
verticalAlign="middle"
verticalCenter="0"/>
<s:Label text="{data.company}"
width="35%" height="50"
verticalAlign="middle"
verticalCenter="0"/>
<s:Label text="{data.building}"
width="35%" height="50"
verticalAlign="middle"
verticalCenter="0"/>
<s:Label text="{data.assets}"
width="15%" height="50"
verticalAlign="middle"
verticalCenter="0"/>
</s:HGroup>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:DataGroup>
</s:Scroller>