0
目前我正在试图添加自定义按钮,将能够当过用户想要添加使用EXTJS 4.一个新的按钮ExtJS的4:如何添加按钮,自定义任何形式
这里是调用我想TimeButton.js文件用来创建按钮
Ext.namespace("Ext.controls");
Ext.create('Ext.Button', {
text: 'Time',
renderTo: Ext.getBody(),
handler: function() {
alert('The current time is '+Date())
}
});
Ext.reg('timebutton', Ext.controls.TimeButton);
但是当过我尝试将其添加到任何形式我碰到下面的错误
types[config.xtype || defaultType] is not a constructor
或者倒不如做些什么像这样
Ext.controls.TimeButton = Ext.extend(Ext.Panel, {
initComponent: function(){
Ext.apply(this, {
frame: true
,height: 330
,layout: 'border'
,layout: 'column'
,split: true
,cls: 'DocumentWindow'
,items: []
});
this.documentGrid = new Ext.controls.DocumentGrid({height: 220,
agentId : this.agentId,
columnWidth: 0.5})
Ext.controls.DocumentPanel.superclass.initComponent.apply(this, arguments);
}
从我理解的情况来看,当尝试实例化(创建)一个不存在的组件时,却发现错误可能在哪里!在我发布的代码中是否有错误?
没有,没有工作,仍然得到了相同的错误信息 – flexinIT
它必须。这个例子是否适合你?你是否删除了旧代码并换成了新代码? –