Question

Je construis une application utilisant 4 flex.

Utilisation <mx:DataGrid> pour afficher un tableau.

Je voudrais ajouter un <s:GlowFilter> à un DataGridColumn.

comment puis-je faire?

merci!

Était-ce utile?

La solution

Vous devez créer un élément avec le moteur de rendu GlowFilter construit Voici un exemple:.

Ma demande:

<?xml version="1.0" encoding="utf-8"?>
<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/mx" minWidth="955" minHeight="600">

    <fx:Declarations>
        <s:ArrayCollection id="dataProvider">
            <fx:Object name="Red" color="0xFF0000" />
            <fx:Object name="Green" color="0x00FF00" />
            <fx:Object name="Blue" color="0x0000FF" />
        </s:ArrayCollection>
    </fx:Declarations>

    <mx:DataGrid  itemRenderer="GlowingRenderer" dataProvider="{dataProvider}" />


</s:Application>

... et voici GlowingRenderer.mxml:

<?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" 
                          focusEnabled="true" creationComplete="trace(this.data)">

    <fx:Script>
        <![CDATA[
            import spark.filters.GlowFilter;
        ]]>
    </fx:Script>

    <s:Label id="lblData" top="0" left="0" right="0" bottom="0" text="{dataGridListData.label}" filters="{[new GlowFilter(this.data.color)]}" />
</s:MXDataGridItemRenderer>

ne semble pas trop jolie, mais fait le travail:)

simon

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top