【问题标题】:Display issue with extjs xtemplateextjs xtemplate 的显示问题
【发布时间】:2013-12-14 07:51:51
【问题描述】:

我正在使用以下 xTemplate 循环数据:

var xtpl=new  Ext.XTemplate(
    '<tpl for=".">',
        '<div style=background-color: {color}; margin:10px;">',
            '<b> Name : </b> {name}<br />',
            '<b> Cars : </b>',
            '<tpl for ="cars">',
                '{.}',
                '{[(xindex < xcount)?", ":""]}',
            '</tpl>',
            '<br />',
        '</div>',
    '</tpl>'
);

样本数据:

var xdata=[{
        color : "#E9E9FF",
        name : 'John',
        cars : ['Jetta','Honda']
        },
        {
        color : "#E9E9FF",
        name : 'Rob',
        cars : ['Passat','Ford','VW']
        }];

输出显示为:

Name : John
Cars : [object Object], 
Name : Rob
Cars : [object Object]

导致汽车无法正常显示的错误是什么?
感谢任何帮助。

【问题讨论】:

    标签: extjs extjs3 extjs-mvc


    【解决方案1】:

    for= 之间有空格时,ExtJS XTemplate 似乎在解析 '&lt;tpl for ="cars"&gt;' 语句时出现问题。

    尝试将此行更改为:

    <tpl for="cars">', 
    

    它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-29
      • 1970-01-01
      相关资源
      最近更新 更多