第一次,很长时间... 我使用的是Ext JS 4.2.2.1144 我有一个网格,我的查询从服务器(php)返回的是json形式的元数据以前是在用户决定重新排列并调整列大小然后保存该信息时生成的。当使用metaChanged函数时,所有字段都像width,dataIndex,align以及所有重新配置网格的东西都很好。我遇到的问题是其中一列需要发送tpl的信息,这实际上是要显示的图像的位置。我的Json看起来像这样Ext JS 4.2元数据tpl不被识别
{
"totalCount":"2",
"root":"items",
"metaData":
{
"fields":[
{"name":"queryid"},
{"name":"createUser"},
{"name":"subject"},
{"name":"priorityImage"}
],
"columns":[
{
"dataIndex":"queryid",
"width":100,
"text":"Queryid"
},
{
"dataIndex":"createUser",
"width":100,
"text":"Owner",
"align":"center"
},
{
"dataIndex":"subject",
"width":200,
"text":"Subject",
"hidden":true
},
{
"dataIndex":"priorityImage",
"width":70,"text":"Priority",
"hidden":true,
"align":"center",
"xtype":"templatecolumn",
"tpl":['<img src="_images/{priorityImage}" height="20px" width="20px" />']
}
]
},
"items":[
{
"queryid":"1",
"createUser":"1",
"subject":"Here is a new project",
"priorityImage":"orange.png"
},
{
"queryid":"1",
"createUser":"1",
"subject":"SAL Form 4",
"priorityImage":"roundlightPurple.png"
}
]
}
我已经尝试了各种发送TPL这个最后一列不同的方式,但他们都不是成功的。任何人有任何线索如何实现这一目标?结果最终成为文本而不是实际的图像。如果我使用默认模型直接从商店中加载网格,我从tpl获取图像,但不通过元数据获取图像。我试过单引号,双引号,没有大括号,用大括号,哈哈。我想出点想法。希望我已经够清楚了。安美居,感谢提前任何帮助,这个人是真正推动我疯了, 感谢, C5