You didn't say what error you got, but did you try this?

private function onItemEditBegin(event:DataGridEvent):void
{
var dgc:DataGridColumn;
dgc = 
event.currentTarget.columns[event.currentTarget.editedItemPosition.colum
nIndex];
if (dgc != null)
{
dgc.itemEditor = new ClassFactory(mx.controls.NumericStepper);
}
}

 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of garyq22
Sent: Thursday, July 31, 2008 12:16 PM
To: [email protected]
Subject: [flexcoders] Selecting an Editor for a DataGridColumn at
runtime - how?

 

Hello Group

I would like to select an Editor for each cell in my DataGrid
depending on other data values that might be in the same row.

I believe I can use the itemEditBegin event to assign and create my
chosen editor. I've got this far and I'm well stuck.

I know the following doesn't work - I just posted it to show that I am
trying :-)

Any assistance greatly appreciated!

private function onItemEditBegin(event:DataGridEvent):void
{
var dgc:DataGridColumn;
dgc = 
event.currentTarget.columns[event.currentTarget.editedItemPosition.colum
nIndex];
if (dgc != null)
{
dgc.itemEditor = IFactory(mx.controls.NumericStepper);
event.currentTarget.createItemEditor();
}
}

 

Reply via email to