1. #1
    Sencha Premium Member lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 日本
    Posts
    638
    Answers
    9
    Vote Rating
    15
    lorezyra will become famous soon enough lorezyra will become famous soon enough

      0  

    Default Answered: Re: Communication between controllers

    Answered: Re: Communication between controllers


    In reference to the Q&A for http://www.sencha.com/forum/showthre...ion+event+fire ...

    I would like to know the proper way to pass parameters/args to the function of the application controller.

    According to the API, I only need to specify as follows:
    fireEvent( String eventName, Object... args )
    I've tried the following, but neither appear to work...
    PHP Code:
    this.application.fireEvent("adminlogevent""testing...");
    this.application.fireEvent("adminlogevent", {msg"testing..."}); 
    The function works fine for the controller that houses it.
    PHP Code:
    //...
        
    init:function(){
            if(
    Ext.isGecko && debugconsole.log(" adminUIviewport.controllerInit()");
            var 
    me=this;
            
    me.application.on({//handle system-application wide events and calls here!!
                
    'systemlogoff'me.adminUIappLogoff,
                
    scopeme
            
    },{
                
    'adminlogevent'me.adminUIappLogBoard,
                
    scopeme
            
    });


    //...
        
    adminUIappLogBoard: function(msg){
            if (
    msg) {
                var 
    timeStamp= new Date();
                
                if(
    Ext.isGecko && debug){console.info(Ext.util.Format.date(timeStamp,"Y/m/d G:i:s") + ":  " msg);}
                
    Ext.StoreMgr.lookup('adminUILog').add({dateTimeExt.util.Format.date(timeStamp,"Y/m/d G:i:s"),descmsg});
                
    //TODO: scroll to bottom of grid?
                /*
                var logHeight=Ext.getCmp("adminUILogger").getHeight();
                Ext.getCmp("adminUILogger").setScrollTop(logHeight); // object.scrollTop = object.scrollHeight
                */
            
    }
        } 
    Can anyone enlighten me? Also, the docs say that fireEvent is supposed to return a Boolean. In firebug, it shows the return as undefined. Is this a bug?
    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!
    ================================================
    And here are my terms...
    1. I don't care if you use my source code. (Known as "Code.")
    2. I don't care if I get any monetary compensation.
    3. I do care to receive credit for Code provided. So, please keep my name in the comments for Code provided.
    4. Code is provided without warranty "AS-IS" and I claim absolutely no warranty nor liability to the quality, security, and run-ability on any platform.
    5. By using Code, you accept all risk inherit with Code regardless if Code has known and yet to be discovered bugs.
    6. You are welcome to change and improve the Code to best meet your needs.
    7. I don't care if you use the Code in a commercial or open-source project.
    8. You are not required to contact me prior to using the Code.
    ================================================
    Simple. Enjoy.

  2. Found the problem! My syntax for this.application.on() was incorrect. Just like the this.control() config, I needed to correctly define my syntax!


    PHP Code:
    //...
        
    init:function(){
            if(
    Ext.isGecko && debugconsole.log(" adminUIviewport.controllerInit()");
            var 
    me=this;
            
    me.application.on({//handle system-application wide events and calls here!!
                
    'systemlogoff'me.adminUIappLogoff,
                
    'adminlogevent'me.adminUIappLogBoard,
                
    scopeme
            
    });


    //...

            


  3. #2
    Sencha Premium Member lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 日本
    Posts
    638
    Answers
    9
    Vote Rating
    15
    lorezyra will become famous soon enough lorezyra will become famous soon enough

      0  

    Default source code

    source code


    Looking at the (4.0.7) source, it appears that you can simply add on the parameters after the eventName.

    PHP Code:
    fireEvent: function(eventName) {
        var 
    name eventName.toLowerCase(),
            
    events this.events,
            
    event events && events[name],
            
    bubbles event && event.bubble;

    return 
    this.continueFireEvent(nameExt.Array.slice(arguments1), bubbles); 
    So, this should be valid:
    Code:
    this.application.fireEvent("adminlogevent", "testing...");
    I'm going to double check my scoping...
    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!
    ================================================
    And here are my terms...
    1. I don't care if you use my source code. (Known as "Code.")
    2. I don't care if I get any monetary compensation.
    3. I do care to receive credit for Code provided. So, please keep my name in the comments for Code provided.
    4. Code is provided without warranty "AS-IS" and I claim absolutely no warranty nor liability to the quality, security, and run-ability on any platform.
    5. By using Code, you accept all risk inherit with Code regardless if Code has known and yet to be discovered bugs.
    6. You are welcome to change and improve the Code to best meet your needs.
    7. I don't care if you use the Code in a commercial or open-source project.
    8. You are not required to contact me prior to using the Code.
    ================================================
    Simple. Enjoy.

  4. #3
    Sencha Premium Member lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 日本
    Posts
    638
    Answers
    9
    Vote Rating
    15
    lorezyra will become famous soon enough lorezyra will become famous soon enough

      0  

    Default


    Found the problem! My syntax for this.application.on() was incorrect. Just like the this.control() config, I needed to correctly define my syntax!


    PHP Code:
    //...
        
    init:function(){
            if(
    Ext.isGecko && debugconsole.log(" adminUIviewport.controllerInit()");
            var 
    me=this;
            
    me.application.on({//handle system-application wide events and calls here!!
                
    'systemlogoff'me.adminUIappLogoff,
                
    'adminlogevent'me.adminUIappLogBoard,
                
    scopeme
            
    });


    //...

            

    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!
    ================================================
    And here are my terms...
    1. I don't care if you use my source code. (Known as "Code.")
    2. I don't care if I get any monetary compensation.
    3. I do care to receive credit for Code provided. So, please keep my name in the comments for Code provided.
    4. Code is provided without warranty "AS-IS" and I claim absolutely no warranty nor liability to the quality, security, and run-ability on any platform.
    5. By using Code, you accept all risk inherit with Code regardless if Code has known and yet to be discovered bugs.
    6. You are welcome to change and improve the Code to best meet your needs.
    7. I don't care if you use the Code in a commercial or open-source project.
    8. You are not required to contact me prior to using the Code.
    ================================================
    Simple. Enjoy.

  5. #4
    Sencha Premium Member lorezyra's Avatar
    Join Date
    Dec 2007
    Location
    Japan -- 日本
    Posts
    638
    Answers
    9
    Vote Rating
    15
    lorezyra will become famous soon enough lorezyra will become famous soon enough

      0  

    Default furthermore

    furthermore


    Both of these do, in fact, work...

    PHP Code:
    this.application.fireEvent("adminlogevent""testing...");
    this.application.fireEvent("adminlogevent", {msg"testing..."}); 
    However, the second statement (obviously) passes an object instead of the text. My function expects a string...
    Perfection as a goal is a nice idea that can point one in a specific direction. However, since "perfection" is an ever changing (evolving?) and moving target, one must admit that perfection can never be obtained...

    When in doubt, check the d4mn source code!
    ================================================
    And here are my terms...
    1. I don't care if you use my source code. (Known as "Code.")
    2. I don't care if I get any monetary compensation.
    3. I do care to receive credit for Code provided. So, please keep my name in the comments for Code provided.
    4. Code is provided without warranty "AS-IS" and I claim absolutely no warranty nor liability to the quality, security, and run-ability on any platform.
    5. By using Code, you accept all risk inherit with Code regardless if Code has known and yet to be discovered bugs.
    6. You are welcome to change and improve the Code to best meet your needs.
    7. I don't care if you use the Code in a commercial or open-source project.
    8. You are not required to contact me prior to using the Code.
    ================================================
    Simple. Enjoy.