Pregunta

Estoy construyendo una aplicación que utiliza la flexión 4.

El uso de <mx:DataGrid> para mostrar una tabla.

Me gustaría añadir un <s:GlowFilter> a un DataGridColumn.

¿cómo puedo hacer eso?

Gracias!

¿Fue útil?

Solución

Es necesario crear un procesador de elementos con el GlowFilter construida en He aquí un ejemplo:.

Mi aplicación:

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

... y aquí está 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>

¿No se ve muy bonito, pero hace el trabajo:)

Simon

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top