Domanda

Sto costruendo un'applicazione che utilizza Flex 4.

Utilizzando <mx:DataGrid> per visualizzare una tabella.

Vorrei aggiungere un <s:GlowFilter> ad un DataGridColumn.

come posso farlo?

grazie!

È stato utile?

Soluzione

È necessario creare un renderer di voci con la GlowFilter costruito in Ecco un esempio:.

La mia domanda:

<?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>

... ed ecco 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>

Non sembra troppo bella, ma non il lavoro:)

Simon

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top