simplfuzz
simplfuzz

Reputation: 12905

Flex : Unable to extend DataGridColumn

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"> 
</mx:DataGridColumn>

Upvotes: 0

Views: 767

Answers (1)

Gerhard Schlager
Gerhard Schlager

Reputation: 3145

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>

Upvotes: 5

Related Questions