hello, I’m just starting with this MODExt / Ext, so sorry if this is too obvious... I’ve built most of this based on looking at how Quip and MODx manager does things, but now I hit a problem that I can’t seem to find answer to..
I have the following windows set up:
yagUpload.window.CreateContainer = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('yagupload.create_new_container')
,id: 'yagupload-window-create-container'
,width: 600
,url: yagUpload.config.connector_url
,action: 'mgr/container/create'
,fields: [{
xtype: 'textfield'
,name: 'name'
,id: 'yagupload-createcontainer-name'
,fieldLabel: _('yagupload.name')
,width: 300
},{
xtype: 'textfield'
,name: 'path'
,id: 'yagupload-createcontainer-path'
,fieldLabel: _('yagupload.path')
,width: 300
}]
,keys: []
});
yagUpload.window.CreateContainer.superclass.constructor.call(this,config);
};
Ext.extend(yagUpload.window.CreateContainer,MODx.Window);
Ext.reg('yagupload-window-create-container',yagUpload.window.CreateContainer);
yagUpload.window.UpdateContainer = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('yagupload.update_container')
,id: 'yagupload-window-update-container'
,width: 600
,url: yagUpload.config.connector_url
,action: 'mgr/container/update'
,fields: [{
xtype: 'hidden'
,name: 'id'
,id: 'yagupload-updatecontainer-id'
},{
xtype: 'textfield'
,name: 'name'
,id: 'yagupload-updatecontainer-name'
,fieldLabel: _('yagupload.name')
,width: 300
},{
xtype: 'textfield'
,name: 'path'
,id: 'yagupload-updatecontainer-path'
,fieldLabel: _('yagupload.path')
,width: 300
}]
,keys: []
});
yagUpload.window.UpdateContainer.superclass.constructor.call(this,config);
};
Ext.extend(yagUpload.window.UpdateContainer,MODx.Window);
Ext.reg('yagupload-window-update-container',yagUpload.window.UpdateContainer);
Then I’m setting data to the UpdateContainer window like this (right click menu item event from grid items) when I’m editing some item:
Ext.extend(yagUpload.grid.Container,MODx.grid.Grid,{
editContainer: function() {
MODx.Ajax.request({
url: yagUpload.config.connector_url
,params: {
action: 'mgr/container/get'
,id: this.getSelections()[0].data.id
}
,listeners: {
'success': {fn:function(r) {
this.windows['update-container'] = MODx.load({
xtype: 'yagupload-window-update-container'
,record: r.object
,listeners: {
'success':{fn:function() {
Ext.getCmp('yagupload-grid-container').refresh();
},scope:this}
,'hide':{fn:function() { this.destroy(); }}
}
});
this.windows['update-container'].setValues(r.object);
this.windows['update-container'].show();
},scope:this}
}
});
}
});
That works ok.. But after I have used that UpdateContainer window and open a new CreateContainer window, via grid toolbar button setup like this:
tbar: [{
text: _('yagupload.create_new_container')
,handler: { xtype: 'yagupload-window-create-container' }
}]
the problem is that the CreateContainer window also has the data on the fields that was set with this.windows[’update-container’].setValues(r.object);
So the questions are:
What I’m doing wrong?
How can I "reset" the window values after the window is closed?
I thought that the ’hide’ listener does that with calling this.destroy();, but apparently not. What is it destroying then?
Why the setting of the form values to a window with setValues() isn’t window specific? How the values come to that other window with completely different type?