PDA

View Full Version : Desktop function problem



dizor
19 Mar 2009, 7:08 AM
Hello,

i have next problem: i want call from other place in code - i do it with



MyDesktop.OrdersWindow.prototype.openTranslatorsDetail();


but i have problem with scope for this function. How i can fix it?



MyDesktop.OrdersWindow = Ext.extend(Ext.app.Module, {
id:'orders-win',
init : function(){
this.launcher = {
text:'Zlecenia',
iconCls:'icon-grid',
handler : this.openDetail,
scope: this
};
},
openTranslatorsDetail:function(){

console.log(this);
console.log(this.app);
console.log(this.app.getDesktop());

var desktop = this.app.getDesktop();
var win = desktop.getWindow('orders-translators-win');
if(!win){
win = desktop.createWindow({
id:'orders-translators-win',
title:'Szczegó?y t?umacza',
iconCls:'icon-grid',
width:500,
height:500,
layout:'form',
shim:false,
animCollapse:true,
constrainHeader:false,
items:{}
})
};
win.show();
...
},
createWindow : function(){
var desktop = this.app.getDesktop();
...
...
}

jsakalos
19 Mar 2009, 12:19 PM
This could help: http://extjs.com/learn/Tutorial:What_is_that_Scope_all_about