Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25

Thread: ExtJs5: Call Controller 2's method from Controller 1

  1. #21
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    769
    Answers
    38

    Default

    Yeah I understand why this happen. Im only looking at solution to solve this problem . Looks like the best would be forward button to fired event and then conditionally compare if panel / view contains that button:

    Code:
    if (this.getView().down(btn)) {
        //logic here..
    }

  2. #22
    Sencha Premium Member Zdeno's Avatar
    Join Date
    Nov 2009
    Location
    Prague
    Posts
    769
    Answers
    38

    Default

    I see one big issue there... when you have complex class with deep structures - in my case panel with fbar where is attachment button passed on you need go trough this structure to find if it contains pressed button. So probably the best way is using reference.

  3. #23
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,450
    Answers
    3997

    Default

    For your case, an abstract controller may be better.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #24
    Sencha User bressi's Avatar
    Join Date
    Jan 2016
    Posts
    20

    Default

    I know this post is quite old .. but I found the solution proposed by mitchellsimoens about correct use of global controllers and listeners. That is a clean and awesome method .. !
    Regards,
    Claudia

  5. #25
    Sencha User
    Join Date
    Jan 2016
    Location
    Chennai
    Posts
    24
    Answers
    2

    Default

    Totally agree to Mitchell's point...I have always let the view or rather the component talk to the controller.. Since controllers are more bound to the components, u dont want to skip something the component already does before invoking the handler.My suggestion is that, if u are sure about the fact that the controller is already instantiated, or rather the owner view of the controller is somewhere in the dom tree, you can manually trigger the event that the controller API listens to,for example,

    Code:
    Ext.ComponentQuery.query()[0].getReferences().<comp reference>.fireEvent('xyz');

    Note : xyz is an event to which your target controller API is bound.

    Thanks
    -Siddharth Ganesh
    BNP Paribas

Page 3 of 3 FirstFirst 123

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •