学习Sencha Touch,并且已经喜欢上它了。在我看来,这比JQTouch要好得多。我只是在一些应用程序的想法,我需要有2个选项卡,第一个选项卡将持有一些数据的ext.List。我已经走了这么远,但有一个问题我不能解决。
问题:当我触摸列表中的名字时,细节面板不会显示。当它不在选项卡面板中时,我一点问题都没有。我试过论坛了,找不到解决方案。
这是我的全部代码(基于许多示例):
ShotjesApp = new Ext.Application({
name: "Shotjes",
launch: function() {
ShotjesApp.detailPanel = new Ext.Panel({
id: 'detailpanel',
tpl: 'Omschrijving: {Naam} <br> <br> {Inhoud}',
dockedItems: [
{
xtype: 'toolbar',
items: [{
text: 'terug',
ui: 'back',
handler: function() {
ShotjesApp.Viewport.setActiveItem('listwrapper', {type:'slide', direction:'right'});
}
}]
}
]
});
ShotjesApp.listPanel = new Ext.List({
id: 'disclosurelist',
store: ListStore,
itemTpl: '<div class="contact">{Naam} {Basis}</div>',
grouped: true,
onItemDisclosure: function(record, btn, index) {
var naam = record.data.Naam;
ShotjesApp.detailPanel.update(record.data);
ShotjesApp.Viewport.setActiveItem('detailpanel') //THIS WON'T WORK?
ShotjesApp.detailPanel.dockedItems.items[0].setTitle(naam);
}
});
ShotjesApp.listWrapper = new Ext.Panel ({
id: 'listwrapper',
layout: 'fit',
items: [ShotjesApp.listPanel],
dockedItems: [
{
dock : 'top',
xtype: 'toolbar',
title: 'Shotjes'
}],
});
this.mainView = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
ui: 'dark',
layout: { pack: 'center' }
},
cardSwitchAnimation: {
type: 'fade',
cover: true
},
items:[{
title: 'Shotjes',
cls: 'card 1',
id: 'card 1',
items: [ShotjesApp.listWrapper, ShotjesApp.detailPanel] ,
iconCls: 'home',
layout: 'card',
}, {
title: 'About',
cls: 'card 2',
id: 'card 2',
html: 'about',
iconCls: 'calendar',
layout: 'card',
}
],
tabBarDock: 'bottom',
fullscreen: true,
layout: 'fit'
});
this.Viewport = this.mainView;
} });
发布于 2011-08-19 23:33:01
尝尝这个
ShotjesApp.Viewport.setActiveItem(ShotjesApp.detailPanel);同样,在您的代码中缺少分号。
发布于 2011-08-20 00:01:47
太好了,谢谢。我还添加了这个,否则幻灯片将作为一个新选项卡打开:
ShotjesApp.Viewport = new Ext.Panel ({
fullscreen: true,
layout: 'card',
cardSwitchAnimation: 'slide',
items: [ShotjesApp.listWrapper, ShotjesApp.detailPanel]
});结合您的更改,它可以完美地工作..
不过,有一个很大的问题。因为视口是全屏的,所以当我按下第二个选项卡时,它不会显示。当我将第二个选项卡设置为Fullscreen: true时,我看到了动画,但第一个选项卡仍然位于它的顶部。
当我在视口中更改fullscreen: false时,老问题又回来了,详细信息窗格也不会显示。
https://stackoverflow.com/questions/7123424
复制相似问题