setActiveItem函数正在启动,但没有任何React,我没有收到任何错误消息......有人能告诉我为什么它不工作吗?
Ext.regModel('team', {
fields: [
{name: 'name', type: 'string'},
]
});
Dashboard = new Ext.Application({
name:'Dashboard',
launch: function(){
//Info list
var detailPanel = new Ext.Panel({
id:'detailPanel',
dock:"top",
items: [{
fullscreen:true,
xtype: 'list',
store: new Ext.data.Store({
model: 'team',
getGroupString : function(record) {
return record.get('name')[0];
},
proxy: new Ext.data.AjaxProxy({
url: 'a.php/pool/listPools'
,method:'post',
reader: {
type: 'json',
root: 'data',
totalCount: 'count'
}
})
,autoLoad:true
}),
sorters: [{
property: 'name',
direction: 'asc'
}],
itemTpl:'<font size="4" face="Helvetica, Arial" color="black">{name}</font>',
grouped: true,
onItemDisclosure : true,
listeners : {
itemtap : function(record,index,item,e){
if (e.getTarget('.x-list-disclosure')) {
var recPool = this.store.data.items[index];
//Ext.Msg.alert([index]);
var redirect = 'showpool.php';
window.location = redirect;
}
// else { Ext.Msg.alert("Item clicked!");}
}
}
}]
})
var outer = new Ext.Panel({
fullscreen:true,
layout:'card',
items:[
detailPanel
]
});
//------------------------------------Toolbar top
var TopPanel = new Ext.Panel({
id:'testview',
fullscreen:true,
style: "background-color: #GGG;",
dockedItems: [
{
dock : 'top',
xtype: 'toolbar',
title: 'Pools',
ui:'light',
items: [
{
text: 'Logout',
ui:'back',
handler: function(){
outer.setActiveItem('detailPanel', { type: 'slide', cover: false, direction: 'left'});
}
}, {xtype: 'spacer'},
{
text: 'Refresh',
ui:'action',
handler: function(){
detailPanel.doLayout();
}
}
]
},
outer]
});
}
});
2条答案
按热度按时间fcg9iug31#
实际上,如果有两个或多个项目添加到面板中,卡片布局用于在视图之间切换。在您的情况下,outer面板由单个视图组成。因此它将始终显示该面板。尝试在outer面板中添加另一个面板,并调用setActiveItem()。
vs91vp4v2#
您在此处将其用作字符串:
请改用变数:
这应该可以。