Results 1 to 3 of 3

Thread: controller refs question

  1. #1
    Sencha User
    Join Date
    Dec 2009
    Posts
    425
    Answers
    2

    Default Answered: controller refs question

    Hi,
    In my controller I have defined a view as
    Code:
    config: {
    
      refs   : {
          main: 'mainview',
          profile: 'profile'
      }}
    Then in a function, I try to access the view as
    Code:
    showProfile: function(){
        var f = this.getProfile();
    
        if(!f){
            f = Ext.create('MyApp.view.main.Profile');
            this.profile = f;
        }
     
        this.getMain().push(f);
    }
    The first line throws a TypeError. If I replace the line with
    var f = this.profile; it works fine.
    Why is this? It should generate a getter.

    Please help

  2. Thank you, yeghikyan.
    The problem was that Ext.app.Controller has its own getProfile() method and that was being called instead of my version.
    Changing profile to profile1 did the trick.

  3. #2
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    574
    Answers
    99

    Default

    Try the following:
    Code:
    config: {
        refs: [{
            ref: 'mainview',
            selector: <SELECTOR> // Look 'Ext.ComponentQuery'
        }, {
            ref: 'profile',
            selector: <SELECTOR> // Look 'Ext.ComponentQuery'
        }]
    }
    "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague." – Edsger W. Dijkstra

  4. #3
    Sencha User
    Join Date
    Dec 2009
    Posts
    425
    Answers
    2

    Default

    Thank you, yeghikyan.
    The problem was that Ext.app.Controller has its own getProfile() method and that was being called instead of my version.
    Changing profile to profile1 did the trick.

Similar Threads

  1. 4.2.2 Controller refs
    By HTK in forum Ext: Q&A
    Replies: 1
    Last Post: 3 Nov 2013, 3:31 AM
  2. Replies: 1
    Last Post: 15 Feb 2013, 10:51 PM
  3. Controller control does not allow Controller refs
    By confile in forum Sencha Architect 2.x: Bugs
    Replies: 5
    Last Post: 21 Nov 2012, 9:11 PM
  4. [CLOSED] Controller control does not allow Controller refs
    By confile in forum Sencha Architect 2.x: Bugs
    Replies: 5
    Last Post: 5 Jun 2012, 10:22 AM

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
  •