1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    0
    Charx is on a distinguished road

      0  

    Exclamation HELP - EXTJS 4 Desktop launch a module from another one

    HELP - EXTJS 4 Desktop launch a module from another one


    Hi,
    I'm coding an application that use the Desktop example and i'm a little lost with a thing concerning modules..And i got mad by the way :-)
    I have a module that display information via a draw component and want to launch another module when clicking on this component.
    Of course, i got an error... : it's stating that this.app.getDesktop() doesn't exists. in fact this.app doesn't exist all when invoking module this way from another module
    So i'm lost with classes here

    my event code :

    PHP Code:
     drawComponent.on({
               
    'click': function() {
             
    console.log('on mouseClick Event');
             
    rectangles this.surface.getGroup('rectangles');
              
             var 
    ext_win = new MyDesktop.GridWindow();
             var 
    t2 ext_win.createWindow()
    ... 
    the code that cause the error on the module:
    PHP Code:
    Ext.define('MyDesktop.GridWindow', {
        
    extend'Ext.ux.desktop.Module',

        
    requires: [
            
    'Ext.data.ArrayStore',
            
    'Ext.util.Format',
            
    'Ext.grid.Panel',
            
    'Ext.grid.RowNumberer'
        
    ],

        
    id:'grid-win',

        
    init : function(){
            
    this.launcher = {
                
    text'Grid Window',
                
    iconCls:'icon-grid',
                
    handler this.createWindow,
                
    scopethis
            
    };
        },

        
    createWindow : function(){
            var 
    desktop this.app.getDesktop();
            var 
    win desktop.getWindow('grid-win');
            if(!
    win){
                
    win desktop.createWindow({
    ... 

  2. #2
    Sencha User
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    0
    Charx is on a distinguished road

      0  

    Default


    some news...

    in the target module createwindow() function, if i replace:
    PHP Code:
    var desktop this.app.getDesktop(); 
    with:
    PHP Code:
    var desktop myDesktopApp.desktop.app.getDesktop(); 
    it works, but i still dont understand how to do this a cleaner way (and i am not a web developper so i'm a bit limited ;-))

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    8
    Vote Rating
    0
    wrfelts is on a distinguished road

      0  

    Default


    Quote Originally Posted by Charx View Post
    some news...

    in the target module createwindow() function, if i replace:
    PHP Code:
    var desktop this.app.getDesktop(); 
    with:
    PHP Code:
    var desktop myDesktopApp.desktop.app.getDesktop(); 
    it works, but i still dont understand how to do this a cleaner way (and i am not a web developper so i'm a bit limited ;-))
    In javascript, it's all about scope. There are a lot of very interesting (infuriating) effects that can happen due to an unexpected 'scope' in the executing code. At the class level of the module 'app' may be defined, but if a button is clicked, the scope is set to the button itself, not the containing class instance. There are some helper configuration settings with most of the ExtJS components to force a scope but I've always found it easier to make sure that each component/store/etc... instance is easily searchable and get a reference that way.

    Read up on scope and get a good understanding of how it's applied within ExtJS. It's worth the effort. You'll have a lot less headaches when you do.

    Randy

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar