PDA

View Full Version : How to access item in array of object in XTemplate?



basememara
8 Feb 2012, 9:06 PM
I have an object that has an array in it. How do I access it in a template if my object looks like this: MyParent.MyChild[0].name?

I tried the following, but no luck:
{MyChild[0].name}
{[values.Child[0].name]}

mitchellsimoens
9 Feb 2012, 9:32 AM
If you don't want to iterate through it you should be able to do:


{[values.MyChild[0].name]}

basememara
9 Feb 2012, 2:48 PM
You are right, it was a bug in my code. I never added the property to my model. Thanks!