tags:

views:

33

answers:

1

I am unable to compile the following Flex application.
All I am trying to do is, to extend DataGridColumn class.
I get the following compile error :

Could not resolve to a component implementation.
DataGridColumnTest/src DataGridColumnTest.mxml line 6

DataGridColumnTest.mxml :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local='*'>
    <mx:DataGrid x="191" y="32">
        <mx:columns>
            <local:ExtendedDataGridColumn headerText="Column 1" dataField="col1">
                 <mx:itemRenderer>
                    <mx:Component>
                        <mx:Button label="test"/>
                    </mx:Component>
                </mx:itemRenderer>
           </local:ExtendedDataGridColumn>
        </mx:columns>
    </mx:DataGrid>
</mx:Application>

ExtendedDataGridColumn.mxml :

<?xml version="1.0" encoding="utf-8"?>
<mx:DataGridColumn xmlns="*" xmlns:mx="http://www.adobe.com/2006/mxml"&gt; 
</mx:DataGridColumn>
+4  A: 

You have to use <local:itemRenderer> instead of <mx:itemRenderer> since itemRenderer is a property of ExtendedDataGridColumn which has the namespace prefix local. The namespace prefix of properties has to match the component's prefix.

So, the correct code is:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local='*'>
    <mx:DataGrid x="191" y="32">
        <mx:columns>
            <local:ExtendedDataGridColumn headerText="Column 1" dataField="col1">
                 <local:itemRenderer>
                    <mx:Component>
                        <mx:Button label="test"/>
                    </mx:Component>
                </local:itemRenderer>
           </local:ExtendedDataGridColumn>
        </mx:columns>
    </mx:DataGrid>
</mx:Application>
Gerhard
+1 Good catch.. :)
Amarghosh