PDA

View Full Version : Possible to call a ExtJS element in a JavaScript function ?



iNes14
8 Nov 2011, 12:32 AM
Hello,

I explain : I want to open this window :



Ext.define("MyDesktop.***",{extend:"Ext.ux.desktop.Module",
id:"***-win",init:function(){this.launcher={text:"***",
handler:this.createWindow,scope:this}},createWindow:function(){
var b=this.app.getDesktop();var a=b.getWindow("***-win");
if(!a){a=b.createWindow({id:"***-win",title:"***",
width:1100,height:200,animCollapse:false,border:false,constrainHeader:true,layout:"fit",
html:'<iframe border="0" frameborder="0" width="100%" height="100%" src="***.html"></iframe> '
})}a.show();return a}});


When I call my function javascript



function test(){
// Here, I want to open ***-win
}


Do you know how I can do ? I must do like that because I have to open the window ***-win when I clicked
on a img.

Thank you

mikhailt
8 Nov 2011, 1:51 AM
ExtJS IS JavaScript.
Sure you can call.

Your code is bad formatted, but I guess the window your mention is an Ext.window.Window
(http://dev.sencha.com/deploy/ext-4.0.7-gpl/docs/index.html#!/api/Ext.window.Window-method-show) class exemplar.

Then to show it just use show() (http://dev.sencha.com/deploy/ext-4.0.7-gpl/docs/index.html#!/api/Ext.window.Window-method-show) method of the window object in your function. Just like mywindow.show();

iNes14
8 Nov 2011, 1:59 AM
Yes, I have done that. I work with the desktop example.

The probleme is : Firebug indicates that the ***-win is not defined