vendredi 23 mai 2014

[XTemplates] How to get an item in list with his index

Hello,

I've a template i do not found anything explaining how to get an item with his index in a list.


I passed a List<Person> persons that contain: List<Person> kids.



Code:



public class Person {
private String name;
private List<Person> kids;
public Person(String name, List<Person> kids) {
this.name = name;
this.kids = kids;
}
public String getName() {
return name;
}
public List<Person> getKids() {
return kids;
}
}

The template below is not working, what is wrong ?


Code:



<div>
<tpl for='.'>
<p>
{#}. Hello {name}! Your first kid is: {kids[0].name} and your last kids is {kids[kids.size-1].name}
</p>
</tpl>
</div>

I'm using GXT 3.1, Thank for reading.


Aucun commentaire:

Enregistrer un commentaire