我需要在一个特定的卡上显示一个刷新按钮,标题栏在某些父面板中定义。我尝试了以下几种方法:
家长小组:
config:
{
layout : 'fit',
items:[
{
xtype:'titlebar',
docked:'top',
title:'Directory',
items:[
{
xtype: 'button', //First Button-visible in all cards
docked: 'left',
iconCls: 'arrow_left',
action: 'back'
},
{
xtype: 'button', //Target button-to be visible in one card only
docked: 'right',
iconCls: 'refresh',
action: 'reset',
hidden: true //hiding this button
}
]
},
{
xtype:'tabpanel',
tabBarPosition:'top',
items:[
{
title: 'Tab1',
xtype: 'Card1'
},
{
title: 'Tab2',
xtype: 'Card2'
}
]
}
]
}我有一个隐藏属性设置为真为上述面板中的刷新按钮,我想设置为一张卡片的假。
在单击按钮时,目标卡被设置为活动。我在buttonTapListener中将隐藏属性更改为false,然后将目标卡设置为active。但是刷新按钮不可见。以下是控制器代码:
onButtonTap: function()
{
...
var getParentPanelRef = this.getParentPanel();
var parentPanelItems = getParentPanelRef.getItems();
console.log(parentPanelItems.items[0].config.items[1].hidden); //Prints true
directoryMainContainerItems.items[0].config.items[1].hidden=false;
console.log(parentPanelItems.items[0].config.items[1].hidden); //Prints false
var directorySearchMainUIRef = this.getSomeOtherParentPanel();
directorySearchMainUIRef.setActiveItem(1); //Switches to target card
}隐藏的值会被更改,但是按钮不会出现。如果是的话,请提出另一种选择。提前谢谢。
发布于 2014-07-18 19:24:45
您可以添加/销毁按钮,而不是隐藏/显示按钮。不久前,我遇到了一个类似的问题,似乎sencha并不总是能检测到什么时候应该重新绘制组件。
https://stackoverflow.com/questions/24822435
复制相似问题