1. #1
    Sencha User
    Join Date
    Apr 2009
    Posts
    48
    Vote Rating
    0
    eleftrik is on a distinguished road

      0  

    Question How to reference a controller's method?

    How to reference a controller's method?


    I know this could be a really trivial question...
    I'm a ExtJS 3.x user and I'm trying to upgrade to 4.0, using MVC.

    How can I reference (call) one controller's method, from another controller (or from inside app.js)?

    I read the MVC tutorial, but I cannot find it.

    Many thanks.

    Erik

  2. #2
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,181
    Vote Rating
    77
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    Good question.

    I'm using MVC but still dont understand how it works behind the scenes.

    For example, I made a view and controller to edit some entity.

    From other controller I instantiate the view and VOALA! the controller "takes control" of the new view which is a modal window BTW.

    How this is done?

    Still a mistery to me!

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 MVC
    Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
    Application Server: Glassfish 3.1.x
    Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5

    If you like my answer please vote!

  3. #3
    Sencha User
    Join Date
    Apr 2009
    Posts
    48
    Vote Rating
    0
    eleftrik is on a distinguished road

      0  

    Default


    I will try to undestand what's going behind the scenes when I understand a little more the basics...

    For example, if I have 2 classes, say APP.controller.User and APP.controller.Profile, how can I call the method "getUserDetails" (located in the first controller) from the controller APP.controller.Profile?

  4. #4
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,181
    Vote Rating
    77
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    There is a method called getController() in Application and in Controller (which delegates to application instance) which looks for controller inside app and if doesnt exists creates it.

    May be you can use such method but as I said, I have no clue how plumping between views and controllers works (I think controller discoveres refs looking thru all DOM).

    So, to call a method from one controller to another should be something like

    PHP Code:
    var controller this.getController("othercontrollername");
    if (!
    controller) {
       
    // Something went bad...
    } else {
       
    // Call the method
       
    controller.someMethod();

    It seems that only one instance of each declared controllers exists in the application.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 MVC
    Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
    Application Server: Glassfish 3.1.x
    Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5

    If you like my answer please vote!

  5. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    22
    Vote Rating
    0
    asl1 is on a distinguished road

      0  

    Default


    Thank you ssamayoa, this morning I tried again, I "discovered" by myself the syntax, and it works

  6. #6
    Sencha Premium Member
    Join Date
    Feb 2010
    Posts
    3
    Vote Rating
    0
    byfirat is on a distinguished road

      0  

    Default


    yourappname.app.getyourcontrollerjscalssController().methehodname()

Thread Participants: 3

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