I need to provide a list of choices for a user to select from in datagrid's column.
I am using classFactory to specify a class for the item Editor of that column. I am using startItemEditorSession to start editing session
and I am using endItemEditorSession to end it. After I run endItemEditorSession the data in the column is shown as [object ListItem].
Do I need to have an item Renderer as well for this column? Because my understanding I dont need it.
Actually, if I'm understanding you correctly, you just need to set the dataField correctly on the GridColumn. It looks like the item renderer just isn't getting the right field from the data to display
My data object is ArrayCollection. I am changing my code to this:
I used XML to get rid of a binding message.
How can I check what data.FamhistRelationshipCode actually is?
Yes, I have breakpoint at this line. I am getting there when datagrid is loading but data has not been set, so I have null for data. Then I am getting when an empty row is added, but I am not getting there when something is selected in the dropdown.
Not sure I can simplify that much.
But here is what I have:
protected function grid_creationCompleteHandler(event:FlexEvent):void
// TODO Auto-generated method stub
var renderer1:ClassFactory = new ClassFactory(LabelItemRenderer);
var editor1:ClassFactory = new ClassFactory(DropDownItemRenderer);
var col1:EditableDataGridColumn = EditableDataGridColumn(grid.columns.getItemAt(0));
col1.itemEditor = editor1;
col1.itemRenderer = renderer1;
That takes me a bit further.
But when I start editing session I am getting:
Error: Object reference not set to an instance of an object.
If I dont create item Renderer I am not getting the error. Any idea?
Thanks for the help.
The first thing I see is that you don't need to create a sub-class of Column, the standard Column class should provide everything you need to specify an itemrenderer for the column. The other thing I would look at is your DropDownItemRenderer class. From the error you described it sounds like you didn't specify a labelFunction or labelField that tells the dropdown how to display the data.
Europe, Middle East and Africa