ext 错误 this.items.containsKey is not a function

代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



work.html
Ext.onReady(function(){ //Ext.QuickTips.init(); // // Ext.MyPanel = new Ext.extend(Ext.Panel,{ // width:800, // height:400, // // }); Ext.MyTab = new Ext.extend(Ext.TabPanel, { activeTab:0, items:[ {title:'校验'} , {title:'查看'} ] }); Ext.MyWindow = new Ext.extend(Ext.Window, { width:800, height:500, items:[new Ext.MyTab()] }); // Ext.reg("Ext.MyTab",Ext.MyTab); var myWindow = new Ext.MyWindow(); myWindow.setTitle('指标校验'); myWindow.render(Ext.getBody()); myWindow.show(); });



1个回答

貌似你还没弄明白类和实例的关系。你这样写就对了:
[code="java"]
Ext.onReady(function(){
Ext.MyTab = new Ext.TabPanel({
activeTab:0,
items:[
{title:'校验'}
,
{title:'查看'}
]
});

Ext.MyWindow = new Ext.extend(Ext.Window, {
width:800,
height:500,
initComponent : function(){
Ext.MyWindow.superclass.initComponent.call(this);
this.add(Ext.MyTab);
}
});

var myWindow = new Ext.MyWindow();

myWindow.setTitle('指标校验');

myWindow.render(Ext.getBody());
myWindow.show();
});

[/code]

立即提问
相关内容推荐