A few things.  First, to subclass anything, it needs to be the top tag.  So, to subclass the datagrid, it'd be:
 
<?xml version="1.0" encoding="utf-8"?>
<mx:DataGrid xmlns:mx="http://www.adobe.com/2006/mxml">
 
</mx:DataGrid>
 
Secondly, say you save that file to "BetterDataGrid.mxml" in com.yourpackage.  To extend that, you'd go:
 
<?xml version="1.0" encoding="utf-8"?>
<view:BetterDataGrid xmlns:view="com.yourpackage.*">
</view:BetterDataGrid>
 
If you want to use your BetterDataGrid, you'd go:
 
<view:BetterDataGrid xmlns:view="com.yourpackage.*" />
 
Make sense?
 
----- Original Message -----
Sent: Thursday, July 06, 2006 12:07 PM
Subject: Re: [flexcoders] How to properly subclass a component using mxml

Nope there are no children.

Also, the specific error message is "could not resolve <mx:columns> to a component implementation."
It provides the same error message when trying to add a dataprovider too.

Hank

On 7/6/06, Tobias Patton <[EMAIL PROTECTED]> wrote:

This is just a shot in the dark:

 

Does your subclass of DataGrid have any children defined? I've never come across this myself, but I've read in various places that if a component has children in its definition, it's not possible to add children when instantiating it.

 

Tobias.

 


From: [email protected] [mailto:[email protected]] On Behalf Of hank williams
Sent: Thursday, July 06, 2006 7:50 AM
To: [email protected]
Subject: [flexcoders] How to properly subclass a component using mxml

 

I want to create a subclass of DataGrid. So far what I have done is to create a new MXML component that is based on DataGrid.

The problem is that if I try to use the new component as if it was a dataGrid, certain things dont work. For example:

<myComp:BetterDataGrid>
     <mx:columns>
            <mx:DataGridColumn headerText="Song Name" dataField="label"/>
            <mx:DataGridColumn headerText="Artist" dataField="label"/>
    </mx:columns>
</myComp:BetterDataGrid>

in the above example, it doesnt like me using the columns construct to define the columns. In order to define columns in this way I need to put then in the actual BetterDataGrid component as opposed to in this instance. This makes it doggone hard to use BetterDataGrid as a generic "better dataGrid" since I cannot define its behavior on an instance by instance basis.

I am sure what I am doing wrong here is simple, but I dont know what.

Any insight appreciated.

Hank


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to