这篇文章主要先容了Flex DataGrid 伪归并单位格思路及代码,需要的伴侣可以参考下
复制代码 代码如下:
<?xml version="1.0" encoding="utf-8"?>
<s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%"
autoDrawBackground="false"
creationComplete="mxitemrenderer1_creationCompleteHandler(event)"
>
<s:layout>
<s:VerticalLayout verticalAlign="middle" horizontalAlign="center"/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Text;
import mx.events.FlexEvent;
protected function mxitemrenderer1_creationCompleteHandler(event:FlexEvent):void
{
var txt1:String = lbl.text.split(",")[0];
var txt2:String = lbl.text.split(",")[1];
lbl1.text = txt1;
lbl2.text = txt2;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(譬喻处事、值工具)放在此处 -->
</fx:Declarations>
<s:Label text="{dataGridListData.label}" visible="false"/>
<s:VGroup gap="2" >
<s:Label color="0x000000" textAlign="center" verticalAlign="middle"/>
<mx:HRule chromeColor="0x999999" alpha="0.3"/>
<s:Label color="0x000000" textAlign="center" verticalAlign="middle"/>
</s:VGroup>
</s:MXDataGridItemRenderer>