I'm trying to configure an AdvancedDataGrid so that grouped columns
correspond to the following configuration:
private var fieldCategories:Array = [
new FieldCategory("profils.identifier", [
new Field("profils.firstname", "firstname", FieldType.STRING),
new Field("profils.lastname", "lastname", FieldType.STRING)
]),
new FieldCategory("profils.contact", [
new Field("profils.private_email", "email_priv", FieldType.STRING),
new Field("profils.private_phone", "tel_priv", FieldType.STRING)
])
];
Where FieldCategory, Field and FieldType are custom classes of my own. So on
creationComplete of the parent container of my AdvancedDataGrid, I run the
following init() method:
public function init():void{
initColumns();
service.loadMembers();
}
public function initColumns():void{
var columnGroups:ArrayCollection = new ArrayCollection();
for each(var fieldCategory:FieldCategory in fieldCategories){
var columnGroup:AdvancedDataGridColumnGroup =
newAdvancedDataGridColumnGroup(ResourceManager.getInstance().getString(
'messages', fieldCategory.nameKey));
var columns:ArrayCollection = new ArrayCollection();
for each(var field:Field in fieldCategory.fields){
var column:AdvancedDataGridColumn = new AdvancedDataGridColumn();
column.headerText = ResourceManager.getInstance().getString('messages',
field.nameKey);
column.dataField = field.dataField;
columns.addItem(column);
}
columnGroup.children = columns.source;
columnGroups.addItem(columnGroup);
}
userDataGrid.groupedColumns = columnGroups.source;
}
And service.loadMembers() calls a RemoteObject method whose result handler
is the following:
public function resultHandler(event:ResultEvent):void{
userDataGrid.dataProvider = (ArrayCollection)(event.result);
}
My remote object returns 50 Objects and each Object has a 'firstname' field
amongst others. I know that records are loaded and the dataProvider loads it
because 50 lines are created in the data grid. Yet, there is nothing
displayed in the cells, as if column.dataField was not correctly assigned.
Any idea on what I may have done wrong?
--
Sébastien Arbogast
http://sebastien-arbogast.com