1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    26
    Vote Rating
    1
    alile is on a distinguished road

      0  

    Default How to Create Custom Controllers, and Then Extend Them

    How to Create Custom Controllers, and Then Extend Them


    I have not been able to find any answers to this in this forum or in the larger web, so I do not know if it is possible in Architect. It is a trivial thing to implement in Ext.js but can see no route to it in Architect. The "create override" button seems to be a possible path, but I cannot find any documentation on what this is actually used for or how to implement it.

    The purpose in this is that I would like to have a custom base controller class, say for a page controller, which I can then extend as needed, eg for the homepage behavior. While there may be little shared behavior between the instances, it would be nice to not have to add a getPageName method to each by hand.

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Posts
    2
    Vote Rating
    0
    Merott is on a distinguished road

      0  

    Default


    Have you found any solution to this? Even with the changes in Sencha Architect 2.2, I can't seem to find a way to achieve this.

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    26
    Vote Rating
    1
    alile is on a distinguished road

      0  

    Default


    Not in architect i have not. a "solution" we came up with was to do an override class for Ext.app.Controller, which then modified all controllers. But you need to be careful, as this is a global change.

  4. #4
    Sencha User
    Join Date
    May 2010
    Location
    Sapiranga, Rio Grande do Sul, Brazil
    Posts
    77
    Vote Rating
    1
    sergiomichels is on a distinguished road

      0  

    Default


    Nothing on this yet? It would be really nice be able to change the extend.

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Brisbane
    Posts
    244
    Vote Rating
    3
    SuperRoo is on a distinguished road

      0  

    Default


    Hi,
    you probably have an answer now but I had the same question and found the answer here

    He gives an example of creating a base controller with view viewport functionality and then creating another controller that extends the first controller, thereby allowing the second controller to have access to the first controller's functions.
    Mitchell Simoens gives other examples of calling other controller functions here.
    I used to have a separate Utility controller that I called with

    this.getApplication().getController('Utility').someFunction(data)

    but now am going to change that

  6. #6
    Sencha Premium Member Dejan Beciric's Avatar
    Join Date
    Feb 2014
    Location
    Belgrade, Serbia
    Posts
    43
    Vote Rating
    6
    Dejan Beciric is on a distinguished road

      0  

    Default


    Hi SuperRoo, but the problem is that I can't see how to inherit a controller from Architect.

  7. #7
    Sencha User jjohnston's Avatar
    Join Date
    Sep 2010
    Posts
    567
    Vote Rating
    20
    jjohnston will become famous soon enough jjohnston will become famous soon enough

      0  

    Default


    I think the best approach for sharing controller methods in Architect is to create a Class with those methods, then add it to the mixins of each individual controller.
    Jason Johnston
    @lojjic
    Sencha Architect Development Team

  8. #8
    Sencha Premium Member Dejan Beciric's Avatar
    Join Date
    Feb 2014
    Location
    Belgrade, Serbia
    Posts
    43
    Vote Rating
    6
    Dejan Beciric is on a distinguished road

      0  

    Default


    @jjonhston - It is one possible approach. Not supporting inheritance is a very big minus for Architect.