Currently i’m retrieving data from my database which is stored in a datagrid. I created a new column which uses an ItemRenderer and inside this I want to show a facebook profile image. I have not stored these inside my database because they can be accessed publicly. I have my user’s facebook ID’s, so I was hoping to bind this data with the required URL to display the correct image.
I have tried both of the following:
<s:Image id="fbImg" source="http://graph.facebook.com/{getUserResult.lastResult.facebookid}/picture?type=normal"/>
and
<s:Image id="fbImg" source="{'http://graph.facebook.com/' + getUserResult.lastResult.facebookid + '/picture?type=normal'}"/>
I’m getting a 1120 error (access of undefined property) but i’m not sure why. My datagrid is populated using <s:AsyncListView list="{getUserResult.lastResult}"/> and I can manage to pull other data from the getUserResult.lastResult.databasefield commands, but not to display an image. The getUserResult refers to a the result of a php function that is called to retrieve data from the database.
Any help is greatly appreciated. Thankyou.
Most likely your itemRenderer does not have access to the getUserResult service; and that is why you’re getting an error that says you’re accessing an undefined property.
In the itemRenderer you must use the data property to access the element of your dataProvider that your renderer is attempting to display.
So, most likely you want to do something like this:
However, I strongly advise against using Binding inside an itemRenderer. Instead, modify the image’s source property in a dataChange event handler (my preference) or by overriding the set data method. Here are a bunch of links about itemRenderers that may help;