【发布时间】:2013-11-25 05:57:35
【问题描述】:
我正在使用 Extjs 4.2,但遇到了问题。
我创建了一个扩展“Window”的对象“Window_Graph”。当我试图隐藏这个对象时,它会产生一个 javascript 错误:“Uncaught TypeError: Cannot call method 'apply' of undefined”。
这是我的对象:
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
});
当我创建我的 window_graph 时:
Ext.getCmp('page1').add({
xtype: 'window_graph',
id: 'graph_1',
width: 500,
height: 300,
x: 10,
y: 10
});
接下来,我尝试像这样隐藏它:
Ext.getCmp('graph_1').hide();
谢谢。
【问题讨论】:
-
您能否显示您想要隐藏的实例的代码?
-
我已经编辑了我的帖子...谢谢。
-
那里一定有其他问题导致问题,我在此页面的下一条评论中尝试了代码并且没有任何问题:try.sencha.com/extjs/4.2.0/docs/Ext.window.Window.1/viewer.html 你看到我拥有的与你拥有的不同吗有吗?
-
我试过的代码:
Ext.onReady(function () { 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',text: 'Modifier'}], autoShow: true, constrain: true }); Ext.create('Ext.panel.Panel', { id: 'myPanel', title: 'Test Panel', renderTo: Ext.getBody() }); Ext.getCmp('myPanel').add({xtype: 'window_graph', id:'myWin'}); Ext.getCmp('myWin').hide() }); -
我也没有发现任何问题:jsfiddle.net/n3g4U/1
标签: extjs