Reputation: 5299
I have a extend FormPanel:
Ext.ns('myapp');
myapp.StandartForm = Ext.extend(Ext.FormPanel, {
id: 'myForm'
,xtype: 'test'
,frame:true
,initComponent: function(){
var self = this;
this.editWindow = new Ext.Window({
id: 'editWSWin',
layout: 'fit',
title:this.editPanelTitle,
autoScroll:false,
width:300,
html:'hi'
});
var config = {
items: [{
layout:'column',
items:[this.grid],
buttons: [{
text: 'Edit',
id: "editBtn",
handler: this.editFormCreate,
scope: this,
hidden: this.editbuttonHidden,
disabled:true
}]
}]};
// apply config
Ext.apply(this, config);
Ext.apply(this.initialConfig, config);
myapp.StandartForm.superclass.initComponent.call(this);
}
, editFormCreate : function (){
this.editWindow.show();
}
});
Ext.reg(myapp.StandartForm.prototype.xtype, myapp.StandartForm);
In this panel i press button Edit
and window showing. After i close window and press Edit
button again but get error:
TypeError: b.dom is undefined
I think it's mean that my window undifined.
How can i extend FormPanel to be able use window correctly?
UPDATE
function to create window:
function test(){
var editWindow = new Ext.Window({
id: 'editWSWin',
layout: 'fit',
title:this.editPanelTitle,
autoScroll:false,
width:300,
html:'hi'
});
return editWindow
}
and call it:
, editFormCreate : function (){
test.show();
}
But its undifined.
Upvotes: 0
Views: 154
Reputation: 30092
When you close the window, it gets destroyed, so you can't show it again. You need to either:
closeAction
property on the windowUpvotes: 2
Reputation: 37524
When you close a Ext.Window
, you dispose of the DOM elements it creates so there is nothing to show anymore. You need to instantiate a new one before showing it in this case.
Upvotes: 1