我有這個下面的代碼,我想顯示圖像和其他html元素作爲嵌套列表的項目。可以實現這一點? 我的代碼是Sencha觸摸與列表項的數字字段和按鈕的嵌套列表?
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icons/logo4_1.png',
glossOnIcon: false,
title:'Item List',
fullscree:true,
onReady: function() {
var data = {
title:'Item List',
text: 'Groceries',
items: [{
text: 'Beverages',
imgURL:'\images\beverage\colas.jpg',
items: [{
text: 'Water',
imgURL:'\images\beverage\colas.jpg',
items: [{
text: 'Sparkling',
imgURL:'\images\beverage\colas.jpg',
leaf: true
},{
text: 'Still',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}]
}, {
text:'Coffee',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}, {
text: 'Espresso',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}, {
text: 'Redbull',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}, {
text: 'Coke',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}, {
text: 'Diet Coke',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}]
},{
text: 'Fruits',
imgURL:'\images\beverage\colas.jpg',
items: [{
text: 'Bananas',
imgURL:'\images\beverage\colas.jpg',
leaf: true
},
{
text: 'Watermelon',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}
,
{
text: 'Grapes',
imgURL:'\images\beverage\colas.jpg',
items: [{text:'Black Grapes',leaf: true},{text:'Green Grapes',leaf:true}]
},
{
text: 'Pear',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}
,{
text: 'Apple',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}]
},
{
text: 'Bread and Bakery',
imgURL:'\images\beverage\colas.jpg',
items: [{
text: 'Bread',
imgURL:'\images\beverage\colas.jpg',
items: [{
text: 'White Bread',
imgURL:'\images\beverage\colas.jpg',
leaf: true,
},
{
text: 'Brown Bread',
imgURL:'\images\beverage\colas.jpg',
leaf: true,
},
{
text: 'Sandwich Bread',
imgURL:'\images\beverage\colas.jpg',
leaf: true,
}]
},{
text: 'Pretzels',
imgURL:'\images\beverage\colas.jpg',
leaf: true
},{
text: 'Cup Cakes',
imgURL:'\images\beverage\colas.jpg',
leaf: true
}]
},{
text: 'Personal Care',
imgURL:'\images\beverage\colas.jpg',
items: [
{
text: 'Shampoo',
imgURL:'\images\beverage\colas.jpg',
items: [
{
text: 'Dove',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
{
text: 'Sunsilk',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
{
text: 'Garnier',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
]
},
{
text: 'Soaps',
imgURL:'\images\beverage\colas.jpg',
items: [
{
text: 'Dove',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
{
text: 'Pears',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
{
text: 'Lux',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
]
},
{
text: 'Hair Oil',
imgURL:'\images\beverage\colas.jpg',
items: [
{
text: 'Vatika',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
{
text: 'Almond Oil',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
{
text: 'Parachute Coconut oil',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
]
},
{
text: 'Body Lotions',
imgURL:'\images\beverage\colas.jpg',
items: [
{
text: 'Dove',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
{
text: 'Ponds',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
{
text: 'Nivea',
imgURL:'\images\beverage\colas.jpg',
leaf:true,
},
]
},
]
}]
};
Ext.regModel('ListItem', {
fields: ['text','imgURL'],
//fields: [{name: 'text', type: 'string'},{name: 'imageURL', type: 'string'}],
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});
var leftNav = new Ext.NestedList({
fullscreen:true,
dock: 'left',
useTitleAsBackText: true,
title: 'Item List',
icon: 'icons/logo4_1.png',
itemTpl : '<img src="{imgURL}" width="100" heigh="100"></img><span>{text}</span> <span><button>Add to Cart</button>',
width: '350',
image:'image',
dockedItems:[{
html:'<img src="icons/logo4_1.png" width="100" height="40"/>',
dock:'top',
}],
store: store,
});
new Ext.Panel({
fullscreen: true,
layout: {
type: 'vbox',
align: 'stretch'
},
defaults: {
flex: 1
},
dockedItems:[leftNav]
});
if(Ext.is.Phone)
{
fullscreen:true;
}
}} )
雖然現在用的是imgUrl的領域它不工作.. PLZ幫助..回答感激..!
其返回圖像的URL字符串中的格式..我沒有得到的圖像。我已經開始學習從過去兩天煎茶觸摸你能plz幫助我out .. – Apoorva 2012-03-15 11:14:28
它的工作.. thnx一噸... :) :) – Apoorva 2012-03-15 11:19:14
還有什麼我要做的,如果我想HTML元素只爲少數項目,而不是所有?任何想法 – Apoorva 2012-03-15 12:16:41