need my AdvancedDat开发者_如何学PythonaGrid group by the name of the person, but I'm having trouble because the groupingField not accept "objectPeople.idPeople"
the name of the groupingField not accept "objectPeople.idPeople"?
GroupingField name="people.idPeople" <--error??
That's because dot is not allowed in field handling.
Explanation.
Inside DataGrid addressing groupingField
property from your item is held with square braces operator:
item[groupingField]
This addressing only supports one level. E.g. if you've got object inside object, you cannot address properties of the second one with square braces in first:
var outer:Object = new Object();
var inner:Object = new Object();
outer["property"] = inner;
inner["value"] = 0;
trace(outer["property.value"]); // runtime error
trace(outer.property.value); // traces 0
outer["property.value"] = 1; // creates property "property.value" in outer
trace(outer["property.value"]); // traces 1
trace(outer.property.value); // still traces 0
Answer.
If you have idPeople
inside your item, you should specify groupingField="idPeople"
.
If you have objectPeople
with idPeople
property inside your item, you should (for instance) write a getter in your item to avoid multiple levels and specify its name in groupinf field property - groupingField="idPeople"
:
public function get idPeople():Number
{
return objectPeople.idPeople;
}
// ...
trace(item["idPeople"]); // works now
精彩评论