If you know that "var data:Object = event.itemRenderer.data;" contains a string, why not just use toString() to put the string value in a string variable?:
And I am not quite following you otherwise. What are you truing to do with describeType()? That is usually used with non-dynamic objects, but you have a simple 2d indexed array, correct? You said, "array of rows and array of cells". Do you mean "array" or do you mean you have nested dynamic objects? If you have nested dynamic ovjects, you can examine them with a for-each or for-in loop. Note, describeType is "costly". That means slow, so be sure you need it. It seems like a dangerous thing to do in a lableFunction. Tracy Spratt Lariat Services Flex development bandwidth available ________________________________ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of tntomek Sent: Thursday, January 29, 2009 6:07 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Bug in ADG?, possible to bind labelFunction to editor with no dataField? Hi, Does anyone have any idea how to edit data that does not come from fixed object properties i.e. myObject.Name but myObject.Attributes[2] which might be name? I have a 2D array, array of rows and array of cells for each row, both are arbitrary. I have this successfully displayed my data in AdvancedDataGrid via labelFunction. public function getContentLabel(item:GridRow, column:CustomLabelColumn) : String { if(item != null) { return item.Cells.getGridLabelCellAt(column.columnIndex).Label; } else { return null; } } How do I edit the data in these columns? I looked at http://www.adobe.com/livedocs/flex/3/html/help.html?content=celleditor_8 .html#197235 <http://www.adobe.com/livedocs/flex/3/html/help.html?content=celleditor_ 8.html#197235> and tried messing around with itemEditBegin and itemEditEnd. I have itemEditBegin working successfully where I am able to display my label in a text box. The itemEditEnd for ADG seems to crash because I'm using typed objects instead of plan strings or XML. In fact I'm convinced there is a bug in the itemEnd base handler. I tried calling preventDefault from the grids itemEnd function but no luck, I am forced to overwrite the event.reason so that the base class doesnt destroy my itemEditor. My issue is here: In AdvancedDataGridBaseEx.as private function itemEditorItemEditEndHandler(event:AdvancedDataGridEvent):void ........... var newData:Object = itemEditorInstance[_columns[event.columnIndex].editorDataField]; var property:String = _columns[event.columnIndex].dataField; var data:Object = event.itemRenderer.data; var typeInfo:String = ""; //WHY is this only XML??? my "data" variable has plan String text and yet I never make it into the typeInfo == String part since typeInfo is "" because the XML loop never executes on an object; for each(var variable:XML in describeType(data).variable) { if (property == variab...@name.tostring <mailto:variable.%40name.toString> ()) { typeInfo = variab...@type.tostring <mailto:variable.%40type.toString> (); break; } } if (typeInfo == "String") { //NEVER make it here if (!(newData is String)) newData = newData.toString(); } //.......... //CRASH HERE since property is null. // data = "Some Text"; if (data[property] != newData) { bChanged = true; data[property] = newData; }