Robinsonx6
asked on
FLEX 2 Programmatically adding DAtagrid column to a datagrid
hi im using the following code to try to add a datagrid column to a datagrid
var dg:DataGrid = new DataGrid();
dg.width=ca_prop_detail.wi dth;
dg.height=ca_prop_detail.h eight;
var dc1:DataGridColumn = new DataGridColumn("DateRange" );
dg.addChildAt(dc1,0);
but i keep getting an error saying
1067: Implicit coercion of a value of type mx.controls.dataGridClasse s:DataGrid Column to an unrelated type flash.display
please help this is very urgent
var dg:DataGrid = new DataGrid();
dg.width=ca_prop_detail.wi
dg.height=ca_prop_detail.h
var dc1:DataGridColumn = new DataGridColumn("DateRange"
dg.addChildAt(dc1,0);
but i keep getting an error saying
1067: Implicit coercion of a value of type mx.controls.dataGridClasse
please help this is very urgent
ASKER
a DataGrid doesnt appear to have a addColumn, any ideas please
Hmm, well despite the fact that it isn't in the Flex documentation, I've seen a couple sites use it. Here's one by Alessandro "Sephiroth" Crugnola:
http://www.sephiroth.it/index.php?blogId=2005_12_06_weekly.html
He does a lot of work with Adobe, in fact he wrote several of the classes for Flash MX (and probably more).
Anyways, check it out. He creates a couple DataGridColumns and uses adColumn() to attach them to a DataGrid.
Cheerio
Gav
http://www.sephiroth.it/index.php?blogId=2005_12_06_weekly.html
He does a lot of work with Adobe, in fact he wrote several of the classes for Flash MX (and probably more).
Anyways, check it out. He creates a couple DataGridColumns and uses adColumn() to attach them to a DataGrid.
Cheerio
Gav
ASKER
im not sure what is happening ,ive seen this link before, ive even created a tiny class to extend the DataGrid in Flex2 and i get no addColumn function,
Weird. Does it give you an error when you compile it, or does it simply not do anything when you try to run it?
ASKER
only error is the original one i posted above it is strange
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mexxter im going to accept your answer, but i still dont get it for me, i think it might be a bug in flex 2
Thanks. Sorry I couldn't be of more help, but I'll keep looking.
I'm going to need this functionality too, and if I find a solution, I'll post it to this question.
Later
Gav
I'm going to need this functionality too, and if I find a solution, I'll post it to this question.
Later
Gav
ASKER
thanks
Chris
Chris
addChildAt() in Flex 2 is used mainly to add components to a display. The error is basically telling you that a DataGridColumn is not a valid component to do this with.
Instead of addChildAt(), try addColumn():
dc1 = new DataGridColumn("DateRange"
dg.addColumn(dc1);
Let me know how it turns out.
Gav