Sencha Touch 二 - Dataview里面实现items迭代并初始化items的一些属性

来源:互联网 发布:python图像识别文字 编辑:程序博客网 时间:2024/05/22 18:38
Sencha Touch 2 - Dataview里面实现items迭代并初始化items的一些属性

前提条件:ST2有很多items放到container里面需要用着模版使用。 items很多属性需要初始化并且赋值。当然itemTpl可以实现迭代。但是有个缺点是只能使用html标签。不能使用ST的一些控件标签。所以本文将介绍怎么使用dataitem方式迭代初始化控件。


item的模版,也就是模版的迭代部分



/**
 * @author larrywoo Email:larrywoo1982@gmail.com
 */
Ext.define('DingCan.view.CartItem', {
extend : 'Ext.Container',
xtype : 'mydataview',
requires : ['Ext.Label'],

config : {
//scrollable : true,

//fullscreen : true,
layout : 'vbox',


items : [{
xtype : 'container',
layout : 'hbox',
items : [{
//id : 'image',
itemId : 'cartimage',
xtype : 'image',
mode : 'tag',
src : '',
cls : 'cart-item-thumb'
},

{
xtype : 'container',
flex : 1,


layout : 'vbox',
items : [{
itemId : 'name',
//id : 'name',
html : '产品名称',
cls : 'cart-item-name'
}, {
xtype : 'container',
cls : 'cart-item-props',


layout : 'vbox',
items : [{
itemId : 'price',
//id : 'price',
html : '价格:¥4.00',
cls : 'item-prop'
}, {
itemId : 'taste',
//id : 'taste',
html : '麻辣,少蒜少葱',
cls : 'item-prop'
}]
}]
}


…………………………………………………………………………

本文固定链接:http://www.verydemo.com/demo_c113_i4055.html

0 0
原创粉丝点击