Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User chris_nl's Avatar
    Join Date
    Nov 2011
    Location
    Amstedam
    Posts
    34
    Vote Rating
    0
    chris_nl is on a distinguished road

      0  

    Question getController method sencha2pr3 does not work.

    getController method sencha2pr3 does not work.


    Ext version tested:
    · Sencha Touch 2.0PR3

    Browser versions tested against:
    · Chrome 16 (Windows)
    · Safari 5.1.2 (Windwos)


    Tested on Iphone and Android phone as well


    Description:
    The method getController as in the documentation does not work and seems to be different in the older versions. It take more parameters if you look in the sencha-touch-all-debug.js

    Is there a workaround to get acces to the controller and to it's methods from a component?

    The result that was expected:
    · The alert should be shown

    The result that occurs instead:
    · Browser freeze

    Test Case:
    In a random Component:
    Code:
    Ext.define('Lericrystal.view.FooterPanel', {
        extend : 'Ext.Panel',
        xtype  : 'leri-panelx',
    
    
        config : {
    
    
    
    
            defaults: {
                listeners: {
                       tap: function(bla) {
                        var main = Ext.app.Application.getController('App');
                         alert(main);
                         alert("ico-tap"+ bla) ;
                        }
                }
            },
    
    
    ....etc..
    The controller
    Code:
    Ext.define('Lericrystal.controller.App', {
        extend : 'Ext.app.Controller',
    
    
    
    
        models : [
            'Page'                                            
        ],
    
    
        stores : [
            'Pages'                                           
        ],
    
    
        views : [
            'List',                                            
            'ListWrap',
            'FooterMenu',
            'Page'
        ]
       ,
    
    
    ....etc..
    Also the method of getController is different and takes other params as described in the documentation;

    Code:
    getController: function(targetType, target, eventName, connectedController) {
            var controller = this.controller,
                info = {
                    targetType: targetType,
                    target: target,
                    eventName: eventName
                };
    
    
            if (!controller) {
                controller = this.controller = new Ext.event.Controller();
            }
    
    
            if (controller.isFiring) {
                controller = new Ext.event.Controller();
            }
    
    
            controller.setInfo(info);
    
    
            if (connectedController && controller !== connectedController) {
                controller.connect(connectedController);
            }
    
    
            return controller;
        },

    This was the previous method in version 2.0

    Code:
     getController: function(name, autoInit) {        var controller = this.controllers.get(name);        if (!controller) {            controller = Ext.create(this.getModuleClassName(name, 'controller'), {                application: this,                id: name            });            this.controllers.add(controller);                if (autoInit !== false) {                controller.init();                if (this.launched) {                    if (controller.onLaunch) {                        controller.onLaunch(this);                    } else {                        controller.launch(this);                    }                }            }        }        return controller;    },



  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,673
    Vote Rating
    749
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Just checked our latest code and this works:

    Code:
    this.getApplication().getController('Test')
    The controller I am looking for was named 'MyApp.controller.Test'
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User chris_nl's Avatar
    Join Date
    Nov 2011
    Location
    Amstedam
    Posts
    34
    Vote Rating
    0
    chris_nl is on a distinguished road

      0  

    Question


    Hello Mitchell,
    I used your MVC Example to test this too, but the getController method does not seem to work.
    I tried using this, but while debugging I noticed this was not the right scope, so I tried to acces the
    method using Ext.app.Application.getController where I can acces and run this method, but still fails to work.

    In your MVC example I only added a listener on the bottom toolbar on a button for test purpuse as you can see below. Could you run this test too if it works? Thanks in advance.

    Code:
    Ext.define('MVCTest.view.Viewport', {
        extend : 'Ext.Container',
        xtype  : 'mvctest-viewport',
    
        config : {
            fullscreen : true,
             layout     : {
               type      : 'card',
               animation : {
                   type : 'slide'
               }
           },
            items      : [
                {
                    xtype        : 'toolbar',
                    docked       : 'top',
                    title        : 'Title',
                    defaultTitle : 'Title',
                    items        : [
                        {
                            text   : 'Back',
                            ui     : 'back',
                            hidden : true
                        }
                    ]
                },
                /**
                 * Here you can specify any items on the bottom toolbar
                 */
                {
                    xtype  : 'toolbar',
                    docked : 'bottom',
                    title  : 'Bottom',
                     items        : [
                        {
                            text   : 'Back',
                            ui     : 'back',
                            listeners : {
                                   tap : function() {
                                    this.getApplication().getController('App');
                                    //var controllerRef =  Ext.app.Application.getController('App') ;
                                    alert("tap");
                                }
                            }
    
                        }
                    ]
    
    
                },
                {
                    xtype : 'mvctest-listwrap'
                }
            ]
        }
    });

  4. #4
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    The problem seems that you didn't provide any scope object for your button.
    Try to add your "Back" button code as follows:

    Code:
    text: 'Back',
    ui: 'back',
    scope: this,
    handler: function(){
          this.getApplication().getController('App');
          var controllerRef =  Ext.app.Application.getController('App');
          alert("tap");
    }
    Hope this helps.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,673
    Vote Rating
    749
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Since the button isn't in a method when defining items in the config object, 'this' is most likely will refer to DOMWindow. The scope in a listener in the controller is that of the controller.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Sencha User chris_nl's Avatar
    Join Date
    Nov 2011
    Location
    Amstedam
    Posts
    34
    Vote Rating
    0
    chris_nl is on a distinguished road

      0  

    Question


    I still can't acces the controllers method with the MVC example.
    Could it be because of the override settings in folder app.Application.js ?
    Or the way the project as been setup?

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,673
    Vote Rating
    749
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If the controller has been included in the Ext.application config then it should work.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  8. #8
    Sencha User chris_nl's Avatar
    Join Date
    Nov 2011
    Location
    Amstedam
    Posts
    34
    Vote Rating
    0
    chris_nl is on a distinguished road

      0  

    Question


    It seems that the App (Controller) is inside the app, as in your example, but i still can't get acces
    to it: I can send you the all the files if you want to see that I can't seem to acces the controllers methods.

    Code:
    Ext.application({
        name               : 'Lericrystal',
        autoCreateViewport : true,          //will automatically create the Lericrystal.view.Viewport class
    
    
         controllers : [
            'App'                           //will load and execute the controller's init. Will prepend 'Lericrystal.controller' to this string
        ]
    });

  9. #9
    Sencha User
    Join Date
    Apr 2011
    Posts
    212
    Vote Rating
    4
    bweiler is on a distinguished road

      0  

    Default


    Is there a workaround to this for ST2 PR3? I'm running into the same problem trying to get a controller from within a view.

    Thanks

  10. #10
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Vote Rating
    16
    tomalex0 will become famous soon enough

      0  

    Default


    Code:
    this.getApplication().getController('Test')
    Just want to make sure if above code works in ST2pr4? previously i have used

    Code:
    this.getController('Test')
    with ST2pr2
    Sencha Touch Demos

    IosToggleField Forum - Github
    Form Validation
    Forum - Github
    Iphone Settings Menu
    Forum
    Sqlite Storage & Login Manifest
    Forum
    KitchenSink MVC
    Forum - Github
    SqliteProxy-v1 Forum - Github
    SqliteProxy-v2
    Forum - Github
    Arshaw Fullcalendar Forum - Github






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