仅当数据数组在某个节点上有项目时,如何才能显示 XTemplate?
例如下面,我只想显示“项目”的模板。(显示第 28 天的“项目”,第 27 天不显示任何内容)
目前它为数组中的所有项目创建 ap 标签,这是我不想要的......
itemTpl : new Ext.XTemplate(
'<tpl for="items">'+
'<p>{classname} {typename}</p>'+
'</tpl>'
),
来自服务器的数据:
{
day:27,
iscurrentmonth:false,
issunday:false,
date:"2013-05-27",
schedulesection:{
id:46694897,
markingperiodid:15156,
name:"Sunday",
number:0
},
announcements:[
],
items:[
]
},
{
day:28,
iscurrentmonth:false,
issunday:false,
date:"2013-05-28",
schedulesection:{
id:46695811,
markingperiodid:15156,
name:"Monday",
number:1
},
announcements:[
],
items:[
{
id:134513,
title:"Subject",
typeid:3,
typename:"Essay",
author:"Bryan Fisher",
classname:"English 9A",
classid:344499,
courseid:60555
},
{
id:134485,
title:"Subject",
typeid:3,
typename:"Essay",
author:"Bryan Fisher",
classname:"English 10",
classid:344500,
courseid:60555
}
]
}
非常感谢