Javascript 选项卡式工具栏内的Sencha触摸列表组件
我正在使用senchatouch框架和列表项组件。我现在只做了大约两个星期,我不知道如何让“onItemDisclosure”打开“detailPanel”。我试图遵循以下示例:。我已将代码粘贴到下面。非常感谢您的帮助Javascript 选项卡式工具栏内的Sencha触摸列表组件,javascript,html,sencha-touch,Javascript,Html,Sencha Touch,我正在使用senchatouch框架和列表项组件。我现在只做了大约两个星期,我不知道如何让“onItemDisclosure”打开“detailPanel”。我试图遵循以下示例:。我已将代码粘贴到下面。非常感谢您的帮助 GoW3Guide.views.detailPanel = Ext.extend(Ext.Panel, { id: 'detailpanel', tpl: 'Hello, {firstName}!', dockedItems
GoW3Guide.views.detailPanel = Ext.extend(Ext.Panel, {
id: 'detailpanel',
tpl: 'Hello, {firstName}!',
dockedItems: [
{
xtype: 'toolbar',
items: [{
text: 'back',
ui: 'back',
handler: function() {
GoW3Guide.Viewport.setActiveItem('disclosurelist', {type:'slide', direction:'right'});
}
}]
}
]
});
Ext.reg('detailPanel', GoW3Guide.views.detailPanel);
GoW3Guide.views.listPanel = Ext.extend(Ext.List, {
id: 'disclosurelist',
store: GoW3Guide.ListStore,
itemTpl: '<div class="contact">{firstName} {lastName}</div>',
grouped: true,
onItemDisclosure: function(record, btn, index) {
GoW3Guide.views.detailPanel.update(record.data);
GoW3Guide.views.Guidescard.setActiveItem('detailpanel');
}
});
Ext.reg('listPanel', GoW3Guide.views.listPanel);
GoW3Guide.views.Guidescard = Ext.extend(Ext.Panel, {
fullscreen: true,
layout: 'card',
cardSwitchAnimation: 'slide',
initComponent: function() {
Ext.apply(this, {
items: [GoW3Guide.views.listPanel, GoW3Guide.views.detailPanel]
});
GoW3Guide.views.Guidescard.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg('guidescard', GoW3Guide.views.Guidescard);
GoW3Guide.views.detailPanel=Ext.extend(Ext.Panel{
id:“detailpanel”,
tpl:'你好,{firstName}!',
摘要:[
{
xtype:'工具栏',
项目:[{
文本:“返回”,
ui:'返回',
处理程序:函数(){
GoW3Guide.Viewport.setActiveItem('disclosurelist',{类型:'slide',方向:'right'});
}
}]
}
]
});
Ext.reg('detailPanel',GoW3Guide.views.detailPanel);
GoW3Guide.views.listPanel=Ext.extend(Ext.List{
id:“披露列表”,
存储:GoW3Guide.ListStore,
itemTpl:“{firstName}{lastName}”,
对,,
OSCLOSURE:功能(记录、btn、索引){
GoW3Guide.views.detailPanel.update(record.data);
GoW3Guide.views.Guidescard.setActiveItem('detailpanel');
}
});
Ext.reg('listPanel',GoW3Guide.views.listPanel);
GoW3Guide.views.Guidescard=Ext.extend(Ext.Panel{
全屏:对,
布局:“卡片”,
CardSwitch动画:“幻灯片”,
initComponent:function(){
Ext.apply(本{
项目:[GoW3Guide.views.listPanel,GoW3Guide.views.detailPanel]
});
GoW3Guide.views.Guidescard.superclass.initComponent.apply(这是参数);
}
});
Ext.reg('guidescard',GoW3Guide.views.guidescard);
您是否收到任何javascript错误
根据文档,setActiveItem需要一个组件实例、一个数字(卡片索引)或一个配置对象,例如{xtype:'detailPanel'}
如果要激活新的详图面板,请尝试
GoW3Guide.views.Guidescard.setActiveItem({xtype:'detailpanel'});
或
GoW3Guide.views.Guidescard.setActiveItem(新的GoW3Guide.views.detailPanel())代码>