Pregunta

Estoy usando el componente Halo AdvancedDatagrid, en el que el ItemEditor predeterminado para cada columna es mx.controls.textinput.

Por ejemplo, el proveedor de datos es: [Código] [Aguja] Private VAR LabelsGridArty: Array= [{Etiqueta: "Apple"}, {Etiqueta: "* Banana"}, {etiqueta: "zanahoria"}]; [/ código] Y la definición avanzadadatagrid es: [Código] [/ código]

Si una cadena de la matriz DataProvider está precedida por un asterisco, como es el caso de Banana en este ejemplo: la cadena debe estar rodeada de corchetes y se muestre en un color gris.

Intenté hacer lo siguiente: [CÓDIGO]

Un colega me contó con el uso del atributo de Liquelfunction del avanceDatagridColumn. Lo intenté, pero no pudo hacer la siguiente asignación (el ID de la columna es 'TAG'): [Código] tag.itemeditor.htmltext= formattedText; [/ código]

ACCESO DE ERROR 'POSITIVO DE POSIBILIDAD HTMLTEXT A TRAVÉS DE UNA REFERENCIA CON TIPO ESTÁTICO MX.CORE: IFACTORY.

Intenté extraer explícitamente extraer explícitamente el punto de texto (como lo hice para los datos establecidos de anulación) y use el lójuego, pero no pude obtener ambos en los ámbitos correctos.

Tu ayuda es muy apreciada, Bonnie

¿Fue útil?

Solución

Try creating your own itemRenderer / itemEditor.

This would be your datagrid:

<fx:Script>
    <![CDATA[
        [Bindable] private var labelsGridArray:Array = [ { tag:"apple" }, { tag:"*banana" }, { tag:"carrot" } ];
    ]]>
</fx:Script>
<mx:DataGrid dataProvider="{labelsGridArray}" >
    <mx:columns>
        <mx:DataGridColumn headerText="Name" itemRenderer="NameItemRenderer"/>
    </mx:columns>
</mx:DataGrid>

And this would be your itemRenderer/editor (NameItemRenderer.mxml)

<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">
<fx:Script>
    <![CDATA[

        override public function set data(value:Object):void{
            super.data = value;
            if(value.tag.indexOf("*")!= -1){
                lblData.text = "[" + value.tag + "]";
                lblData.setStyle("color",0xFF0000);
            }
            else{
                lblData.text = "" + value.tag ;
                lblData.setStyle("color",0x000000);
            }
        }
    ]]>
</fx:Script>
<s:Label id="lblData" top="0" left="0" right="0" bottom="0"/>

I have used a normal mx:Datagrid and a spark MXDataGridItemRenderer for this, but the way it works will be the same for the AdvancedDataGrid. All you need to do is override set data()

Cheers

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