4,328
社区成员
发帖
与我相关
我的任务
分享
import mx.collections.ArrayCollection;
import mx.controls.ComboBox;
import mx.events.FlexEvent;
public class ComboBoxItemRender extends ComboBox
{
private var _data:Object;
public function ComboBoxItemRender()
{
super();
this.width = 100;
this.addEventListener(FlexEvent.VALUE_COMMIT,valueCommitHandler);
}
override public function get data():Object
{
return _data;
}
override public function set data(value:Object):void
{
this._data = value;
}
private function valueCommitHandler(event:FlexEvent):void{
}
}
然后在设置 itemRenderer="包名.ComboBoxItemRender"
import mx.collections.ArrayCollection;
mx:DataGrid x="0" y="0" id="myDG" dataProvider="{_AppData}" width="100%" height="100%" itemClick="datagrid1_itemClickHandler(event)">
<mx:columns>
<mx:DataGridColumn headerText="河段" dataField="sHeDuan" />
<mx:DataGridColumn headerText="目标" dataField="sMuBiao" />
<mx:DataGridColumn headerText="现状" width="260">
<mx:itemRenderer>
<mx:Component>
<mx:HBox paddingTop="6" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Image source="images/{data.sXIanZhuangImg}">
</mx:Image>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="达标">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign="center" paddingTop="6" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Image source="images/{data.sDaBiaoImg}">
</mx:Image>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="主达标项" width="130" dataField="sZHaoBiaoXiang"/>
<mx:DataGridColumn headerText="图表" dataField="sMuBiao" width="80">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign="center" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Button useHandCursor="true" buttonMode="true" click="button1_clickHandler(event)" upSkin="@Embed(source='../images/chart_line.png')" overSkin="@Embed(source='../images/chart_line.png')" downSkin="@Embed(source='../images/chart_line.png')">
<mx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
{
//trace(outerDocument.myDG.selectedItem.sId);
//弹出对话框
outerDocument.btnClick_Fun();
}
]]>
</mx:Script>
</mx:Button>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>