Hi Jared
You can always try the
Sencha forums for ExtJS assistance but I've found you don't get much of a response and the participants are often quite arrogant (especially the core team).
I'd love to have more discussion about MODExt/ExtJS in these forums as it's very relevant to Revo development
I think your problem is you are calling console.log(this) immediately when the Window is initialised - you are setting this.relation
after it is initially loaded so that's why it's undefined. I wouldn't call myself an ExtJS expert but I've certainly come across this issue before.
If you add your console.log on line 132 the relation value should show up:
this.updateItemWindow.show(e.target);
console.log(this.updateItemWindow);
The thing is, because you are showing and hiding your window the grid contained in it is only going to be rendered once and the store only loaded on the first time. Changing the Window config is not going to have any effect as it's only used for the initial setup.
I would probably restructure your updateItem code like this, giving your item grid an id (,id: 'id-of-item-grid') and reload it with the new 'pid' value before re-showing the window.:
updateItem: function(btn,e) {
var pid = this.menu.record.id;
if (!this.updateItemWindow) {
this.updateItemWindow = MODx.load({
xtype: 'easyinventory-window-item-update'
,params: {
pdid: this.menu.record.id // not really sure what this does?!
,relation = pid // isn't this the same value as pdid?
}
,listeners: {
'success': {fn:this.refresh,scope:this}
}
});
} else {
// reload your item grid with new pid
var itemGrid = Ext.getCmp('id-of-item-grid'),
itemGridStore = itemGrid.getStore();
itemGridStore.baseParams.pid = pid;
itemGrid.getBottomToolbar().changePage(1);
itemGrid.refresh();
}
this.updateItemWindow.setValues(this.menu.record);
this.updateItemWindow.show(e.target);
}
Note I didn't really understand exactly what 'pid' and 'pdid' are doing but I hope that helps a little. Not tested!
Luke
[ed. note: okyanet last edited this post 14 years, 2 months ago.]