我正在加载itemtap上的嵌套列表。我需要加载的是一个文件夹图像,以防其不是一个叶节点,而是一个文档图像以防其叶节点。使用json商店加载图像
我认为这样做的一种方式是将图像加载到json数据本身。但我不确定如何实现这一点。
截至目前我的模型只包含一个字符串数据。我将如何加载图像数据在thr?
//Defining a data structure for the Nested List
Ext.define('InfoImage.model.nestedListModel', {
extend: 'Ext.data.Model',
config:{
fullscreen:'true',
title:'Work Items Task 1',
ui:'normal',
cls:'nestedlistCls',
xtype:'nestedList',
// displayField : 'text',
store:'nestedListStore'/*,
getItemTextTpl: function() {
var tplConstructor = '{text}' +
'<tpl if="model === \'folder\'">'+
'<img src="resources/images/refresh.png" >'
'</img>' +
'</tpl>';
return tplConstructor;
}*/
// itemTpl:'<div><img src="resources/images/refresh.png" > </img>{text}</div>'*/
}
});
和我的JSON数据的代码是:
{
"items":[
{
"text":"1.1",
"folder":"resources/images/refresh.png",
"items":[
{
"text":"1.1.1",
"items":[
{
"text":"1.a",
"leaf":true
}]
}
]
},
{
"text":"1.2",
"items":[
{
"text":"1.2.1",
"leaf":true
}
]
},
{
"text":"1.3",
"items":[
{
"text":"1.3.1",
"leaf":true
}
]
}
]
}
任何帮助表示赞赏。
在此先感谢。
json文件基本上只是一个文本文件,我认为你应该只读取图像'src'并将其保存为普通字符串。如果是这样,那很容易做到,那是你需要的吗? – 2012-04-29 06:34:59
我需要的是非常简单的。我只需要2张图片。当它不是一个叶节点,而是另一个与叶节点一起加载时,一个被加载到列表中。任何想法如何我可以实现这一目标? – Khush 2012-04-29 07:24:31
似乎你可能想要使用这两个事件:'itemtap'和'leafitemtap' – 2012-04-29 07:51:18