views:

2106

answers:

2

I know AdvancedDataGrid has a styleFunction callback, but I don't want to change the style; I want the itemRenderer to get the global style that everything else (including normal columns) uses.

My in-line item renderers use the default style, but not the ones I created as separate MXML classes (they extend Canvas).

Any handle I need to jiggle to propagate the style into my item renderers?

Thanks

+1  A: 

I don't think you can propagate. Seems like styleFunction is for something completly different. But you can access any CSS property

var styleDecl:CSSStyleDeclaration = StyleManager.getStyleDeclaration("YourTagOrClassName");

and then:

styleDecl.getStyle(property);

If you want to get style declaration directly from the AdvancedDataGrid you have to get renderers listData:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
    implements="mx.controls.listClasses.IDropInListItemRenderer">

    <mx:Script>
        import mx.controls.dataGridClasses.DataGridListData;
        import mx.controls.listClasses.BaseListData;
        [Bindable("dataChange")] private var _listData : BaseListData;
        public function get listData():BaseListData
        {
            return _listData;            
        }                   
        public function set listData( value : BaseListData ) : void
        {
            _listData = value;
        }
        override public function set data(value:Object):void
        {
            super.data = value;
            if (this.listData)
                ((this.listData as DataGridListData).owner as AdvancedDataGrid).getStyle(...);
        }
    </mx:Script>

</mx:Canvas>
radekg
A: 

My Bad

It was picking up the style from the ADG; that component's style was not defaulted to the global style.

Richard Haven