1

是否可以将 itemrenderer 放在 DataGrid 本身而不是 datagridcolumn 上?我只能找到 datagridcolumn 的示例。我想要数据网格中所有项目的通用 itemrenderer ...

4

1 回答 1

3

是的。(这是一个 Flex 4 示例,但 3 也是如此)

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable] private var dp:ArrayCollection = new ArrayCollection([{far:"test",sight:"test"},{far:"test",sight:"test"},{far:"test",sight:"test"},{far:"test",sight:"test"}]);
        ]]>
    </fx:Script>
    <mx:DataGrid width="100%" height="100%" dataProvider="{dp}">
        <mx:itemRenderer>
            <fx:Component>
                <mx:Label text="woot there it is"/>
            </fx:Component>
        </mx:itemRenderer>
    </mx:DataGrid>
</s:Application>

Peter Ent 的 itemRenderer 系列是杀手级的。

于 2009-07-08T15:27:05.563 回答