1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    15
    Vote Rating
    0
    marzapower is on a distinguished road

      0  

    Default Sending messages from a controller to another

    Sending messages from a controller to another


    Hello,
    I've started working on a large project, that I want to build using just Ext JS 4 for the front-end.
    I am studying and trying how the MVC framework works and I am stuck in a simple problem: how can I access the application instance and/or another controller instance from within a controller?

    I want a controller to handle the behaviour of various other controller as an orchestrator, but I really do not know who to do it, and the Ext JS 4.0.0 documentation is really bad, since it's broken, incomplete and not up-to-date.

    Any suggestions?
    Thank you very much!

  2. #2
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    that's simple.

    Your application has a name property, you can use this. For example your application name is AM, then do
    Code:
    AM.controller.Users.doSomething()
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  3. #3
    Sencha User
    Join Date
    Jul 2010
    Posts
    15
    Vote Rating
    0
    marzapower is on a distinguished road

      0  

    Default


    Hi Steffen,
    using the Chrome console, I can reach the controller (eg. Dsa.controller.Map), but I cannot use methods on it.

    E.g.:

    PHP Code:
    Ext.define('Dsa.controller.Map', {
        
    extend'Ext.app.Controller',
        
    doSomething: function() {
            
    Ext.Msg.alert('Alert''Hello world!');
        }
    }); 
    but, in the console:

    PHP Code:
    Dsa.controller.Map 
    is a function, and

    PHP Code:
    Dsa.controller.Map.doSomething() 
    raises an error:

    TypeError: Object function () {
    return this.constructor.apply(this, arguments);
    } has no method 'doSomething'

    Is something wrong in this?

  4. #4
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    this works:

    Code:
    Dsa.controller.Map.prototype.doSomething()
    don't know if this is a good practise though ...
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  5. #5
    Sencha User
    Join Date
    Jul 2010
    Posts
    15
    Vote Rating
    0
    marzapower is on a distinguished road

      0  

    Default


    Quote Originally Posted by steffenk View Post
    don't know if this is a good practise though ...
    Probably not ... The best solution I can think of now is to define some methods within the 'statics' property, so that they are publicly accessible. But since a controller gets instantiated by the application, so it lives somewhere, I really would like to access that instance instead.

    I do not know if THIS is a good practice ...

  6. #6
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    i think we have to explore and try to get the things run. After some time we'll see what the best practise is, but we have no good example for a complex application yet.

    This will be community driven i guess
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  7. #7
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    Quote Originally Posted by marzapower View Post
    Probably not ... The best solution I can think of now is to define some methods within the 'statics' property, so that they are publicly accessible. But since a controller gets instantiated by the application, so it lives somewhere, I really would like to access that instance instead.
    This is done with the example. Have a look at Application.js, there are not many possibilities beside.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  8. #8
    Sencha User
    Join Date
    Jul 2010
    Posts
    15
    Vote Rating
    0
    marzapower is on a distinguished road

      0  

    Default


    Quote Originally Posted by steffenk View Post
    This is done with the example. Have a look at Application.js, there are not many possibilities beside.
    Sorry, I cannot find the Application.js you are referring to.
    By the way, using the 'statics' way, I can no more access all the private methods built through the 'refs' option. What a mess ...

  9. #9
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,649
    Vote Rating
    6
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    look into src/app to find the MVC classes
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  10. #10
    Sencha User
    Join Date
    Jul 2010
    Posts
    15
    Vote Rating
    0
    marzapower is on a distinguished road

      0  

    Default


    Probably the real question is: how can I access the instance of my application?
    Could I access it, I would be able to reach its inner 'controllers' parameter, and probably it all will work correctly ...

Similar Threads

  1. GET, PUT and POST for the COntroller
    By PCD in forum Ext Designer: Help & Discussion
    Replies: 4
    Last Post: 7 Apr 2011, 2:18 AM
  2. [ZEND Framework + ExtJS 3] Sending data to the Controller
    By Raqil in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 24 Jul 2010, 3:59 PM
  3. BadRequest Error while sending long Parameter to controller methods
    By henryivy in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 7 Aug 2009, 6:04 AM
  4. View, Controller and RPC
    By sdc in forum Community Discussion
    Replies: 2
    Last Post: 13 Dec 2008, 3:46 AM
  5. Controller in CodeIgniter can't read param sending from Ext.grid.GridPanel
    By shuchanlagi in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 14 Aug 2008, 12:09 AM

Thread Participants: 6

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