Extjs-无法隐藏窗口
我正在使用ExtJS4.2,但遇到了一个问题 我创建了一个对象“Window\u Graph”,它扩展了“Window”。当我试图隐藏这个对象时,它会产生一个javascript错误:“uncaughttypeerror:无法调用undefined的'apply'方法” 我的目标是:Extjs-无法隐藏窗口,extjs,Extjs,我正在使用ExtJS4.2,但遇到了一个问题 我创建了一个对象“Window\u Graph”,它扩展了“Window”。当我试图隐藏这个对象时,它会产生一个javascript错误:“uncaughttypeerror:无法调用undefined的'apply'方法” 我的目标是: Ext.define('PFS.view.Window_Graph', { extend: 'Ext.Window', alias: 'widget.window_graph', layou
Ext.define('PFS.view.Window_Graph', {
extend: 'Ext.Window',
alias: 'widget.window_graph',
layout: 'fit',
border: false,
closable: true,
header: true,
draggable: true,
resizable: true,
border: false,
tbar: [
{ xtype: 'button', action: 'modifier', text: 'Modifier', iconCls: 'iconAppEdit' },
{ xtype: 'button', action: 'deplacer', text: 'Déplacer', iconCls: 'iconArrowOut' },
{ xtype: 'button', action: 'redimensionner', text: 'Redimensionner', iconCls: 'iconShapeHandles'},
{ xtype: 'button', action: 'supprimer', text: 'Supprimer', iconCls: 'iconCross' },
],
autoShow: true,
constrain: true
});
当我创建我的窗口图时:
Ext.getCmp('page1').add({
xtype: 'window_graph',
id: 'graph_1',
width: 500,
height: 300,
x: 10,
y: 10
});
接下来,我试着这样隐藏它:
Ext.getCmp('graph_1').hide();
谢谢。Ext.getCmp在您的情况下正在返回未定义的! 这就是错误消息告诉您的 我想我知道你得到这个的原因。 初始化过程尚未完成。您调用
Ext.getCmp(“图1”)
太早了。如果要在创建时隐藏窗口,请使用autoShow=false
或者你也可以试试这个
var graphWindow = Ext.ComponentQuery.query("window_graph")[0];
debugger; //look in the console if you are getting an object back.
graphWindow.hide();
你能把代码显示在你想要隐藏的实例的地方吗?我已经编辑了我的帖子。。。谢谢。肯定是有其他东西引起了问题,我在下一篇评论中尝试了代码,没有任何问题:你看到我的和你的有什么不同吗?我尝试的代码:
Ext.onReady(function(){Ext.define('PFS.view.Window_Graph'),{extend:'Ext.Window',别名:'widget.Window_graph',布局:'fit',border:false,closable:true,header:true,draggable:true,resize:true,border:false,tbar:[{xtype:'button',text:'Modifier'}],autoShow:true,constraint:true});Ext.create('Ext.panel.panel',{id:'myPanel',title:'testpanel',renderTo:Ext.getBody()});Ext.getCmp('myPanel')。add({xtype:'window_graph',id:'myWin'});Ext.getCmp('myWin')。hide()});
我也没有看到任何问题: