PDA

View Full Version : Ext XTemplate how to implement nested loop



godghdai
27 Sep 2010, 7:13 AM
var dataObj=[
{
id:1,
name:'name1',
items:[{itemName:'item11'},{itemName:'item12'}]
},
{
id:2,
name:'name2',
items:[{itemName:'item21'},{itemName:'item22'}]
}
];
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<p>{name}</p>',
'<tpl for="items">',
'<p>{itemName}</p>',
'</tpl>',
'</tpl>'
);
tpl.overwrite(document.body, dataObj);

This code do not work ,Ext template does not support nested loop???

StuartAshworth
27 Sep 2010, 7:39 AM
That works perfectly for me.

plalx
27 Sep 2010, 7:52 AM
Works for me too with 3.2.1