我尝试实现一个简单的视图,这是一个“弹出”像sencha touch 2.3.x.使用视窗弹出窗口永远不会隐藏Sencha
我在我的NavBar中有一个按钮,我显示一个List,一个searchview和一个按钮,以取消这个弹出。
但是,当我试图隐藏或删除弹出当我们点击取消按钮,这并不工作..
这里是我的控制器主要方法:
Ext.define('Kone.controller.Equipment', {
extend: 'Ext.app.Controller',
config: {
refs: {
buttonEquipment: 'button#buttonEquipment'
},
control: {
"searchfield#mysearchfield": {
keyup: 'onSearchfieldKeyup'
},
"button#buttonEquipment": {
tap: 'onButtonTap'
}
}
},
onButtonTap: function(button, e, eOpts) {
//get the configuration of the list
var listConfiguration = this.getListConfiguration();
//check if the device is a phone
if (!Ext.os.is.Phone) {
//add a panel into the viewport
Ext.Viewport.add({
//panel gets special styling when it is floating
xtype: 'panel',
//give it a fixed width and height
width: 380,
height: 420,
//center the panel
centered: true,
//modal gives it a mask
modal: true,
//disable the hide on mask tap functionality of modal
hideOnMaskTap: false,
//give it a fit layout so the list item stretches to the size of this panel
layout: 'fit',
//give it 1 item which is the listConfiguration
items: [listConfiguration]
}).show();
} else {
//add the list into the viewport
Ext.Viewport.add(this.listConfiguration);
}
},
getListConfiguration: function() {
return {
id:'equipmentPanel',
//give it an xtype of list
xtype: 'list',
ui: 'round',
pinHeaders: false,
//itemTpl defines the template for each item in the list
itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
//give it a link to the store instance
store: this.getStore(),
useSimpleItems: true,
grouped: true,
emptyText: '<div style="margin-top: 20px; text-align: center">Aucun équipement correspondant..</div>',
disableSelection: true,
items: [
{
xtype: 'toolbar',
docked: 'top',
items: [
{ xtype: 'spacer' },
{
xtype: 'searchfield',
placeHolder: 'Equipement...',
listeners: {
scope: this,
clearicontap: this.onSearchClearIconTap,
keyup: this.onSearchKeyUp
}
},
{ xtype: 'spacer' }
]
},
{
xtype: 'button',
itemId: 'retourButton',
text: 'Retour',
docked: 'bottom',
handler : function(){
Ext.getCmp('equipmentPanel').hide();
}
}
]
};
}
});
此代码:
xtype: 'button',
itemId: 'retourButton',
text: 'Retour',
docked: 'bottom',
handler : function(){
Ext.getCmp('equipmentPanel').hide();
}
only隐藏内容(列表+按钮..),但白色网格背景停留在我的视图之上.. 并删除方法不起作用..
是的,我知道,但如何隐藏整个对象? – eento
给你的面板一个“itemId”(例如“mypanel”),然后调用Ext.Viewport.down('#mypanel')。hide() – arthurakay
问题是我从来没有使用面板..我直接调用getListConfiguration()返回整个对象.. – eento