This content has been marked as final. Show 3 replies
"Myonlycrummynick" <email@example.com> wrote in message
> Hi guys.
> I'm building a flex application getting data from at webservice. The
> from the webservice looks like the coded pasted in at the buttom.
> An array of person-objects each with a single info-object inside it. All
> good for the firstname and lastname part, i can use the following code -
> event.result is the response from my webservice:
> var arrResult:ArrayCollection = new ArrayCollection();
> arrResult.source = event.result.toArray();
> dg1.dataProvider = arrResult;
> firstnameField.dataField = "Firstname";
> lastnameField.dataField = "Lastname";
> But what if i want to insert the phonenumber into the 3rd column called
> phoneField? I'd like to use:
> phoneField.dataField = "Info.Phone"; // Not working...
Try labelFunction instead.
As Amy says, labelFunction is the way to go.
"labelField: can only take a string, which is the name of a first level property of the item. Usually an object property, or an xml attribute or an xml child node text value.
It can *not* take an expression, like Info.Phone.
Sorry for the late answer, you are both right on.
For the record - i used
phonefield.labelFunction = myLabelFunc;
private function myLabelFunc(item:Object,column:DataGridColumn):String