現在、ユーザーが 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);
}
私が理解していることから、これは、存在しないコンポーネントをインスタンス化 (作成) しようとすると発生しますが、エラーがどこにあるのかわかりません! 私が投稿したコードにエラーはありますか?