1
第一个程序逻辑:向面板添加旋转木马
我有一个主面板,左侧有一个列表,另一个面板在右侧。
当用户触摸列表项时,一些html出现在右侧面板中。我需要做的是使用轮播而不是右侧面板。
我的观点
Ext.define('MyApp.view.MyPanel', {
extend: 'Ext.Panel',
xtype:'mypanel',
config: {
ui: 'dark',
layout: {
type: 'card'
},
items: [
{
xtype: 'titlebar',
docked: 'top',
title: 'Lezzet Dunyasi',
},
{
xtype: 'list',
docked: 'left',
id: 'mylist',
ui: 'round',
pinHeaders: false,
grouped: true,
//disableSelection: true,
width: 331,
itemTpl: [
'<img src="{img_url}" width="60" heigh="60"></img><span>{label}</span>'
],
store: 'Menius',
items: [
{
xtype: 'searchfield',
docked: 'top',
placeHolder: 'Search...',
},
]
},
{
xtype: 'panel',
styleHtmlContent:true,
style: {
backgroundImage: 'url(resources/img/Landscape.png)',
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center'
},
id:'mypanel'
}
]
}
});
正如你可以看到有一个的xtype:面板和我试图修改代码,我做了这样的
xtype: 'carousel',
defaults{
styleHtmlContent:true,
id:'mypanel'},
items: [
{
html : 'Item 1',
style: 'background-color: #5E99CC'
},
{
html : 'Item 2',
style: 'background-color: #759E60'
},
{
html : 'Item 3'
}
]
此外,我使用控制器
Ext.define('MyApp.controller.MeniuController',{
extend:'Ext.app.Controller',
config:{
refs:{
leftMeniu:'mypanel list[id=mylist]',
myPanel:'mypanel panel[id=mypanel]'
},
control:{
leftMeniu:{
itemtap:'onItemTap'
}
}
},
onItemTap:function(list, index, item, record, e , opts)
{
var content = '<h2>' + record.get('label') +'</h2>' + record.get('html');
this.getMyPanel().setHtml(content);
}
});
而且我修改这部分这样
refs:{
leftMeniu:'mypanel list[id=mylist]',
myPanel:'mypanel carousel[id=mypanel]'
虽然这些修改我不能运行我的代码,我应该怎么办?
我应该添加旋转木马部分而不是面板在我看来,我理解你了吗? 另外我修改了我的代码根据你的回应,但我没有在我的浏览器中,所以我把senchafiddle,请你检查一下,说我的错是什么? http://www.senchafiddle.com/#9abi9 THX为您concerne。 – 2012-04-24 15:59:34
您可以放入我的{carousel}以替换您的面板。你是否也切换到旋转木马的第2页?你看到3个页面点?我正在写它:this.getMySecondPanel()。setHtml(content); ...我只是更新了我的代码以包含完整的MyPanel视图。 – 2012-04-24 16:52:46
将我的控制器更改为写入传送带中的两个面板,以便运行代码的任何人都能看到明显的情况。 – 2012-04-24 17:02:14