Results 1 to 9 of 9

Thread: How to Create Custom Controllers, and Then Extend Them

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    26
    Vote Rating
    4
      0  

    Default 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
      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
    4
      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
      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
    4
      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
    48
    Vote Rating
    8
      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
    21
      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
    48
    Vote Rating
    8
      0  

    Default

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

  9. #9
    Sencha User
    Join Date
    Sep 2014
    Posts
    1
    Vote Rating
    0
      0  

    Default Any progress in this

    Hi,

    I am having same issue with Sencha Architect. I cannot extend controller from my custom controller.
    Please post the workaround if you guys have any.

Posting Permissions

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