2016-07-27 2 views
0

새로운 Extjs 사용자입니다. 탐색기 내부에 컨트롤러를 정의했지만 작동하지 않습니다. 도와주세요.Extjs 컨트롤러가 내비게이션을 정의합니다.

Ext.define('MyApp.controller.Navigation', { 
    extend: 'Ext.app.Controller', 
    alias: 'widget.navigationController', 

    views: ['Navigation'], 


    refs : [{ 
     ref: 'navigationView', 
     selector: 'navigation' 
    }], 


    init: function(application){ 
     console.log('controller init'); 
     this.control({ 
      'navigation': { 
       'golocale': this.goLocale, 
       'gobrand': this.goBrand, 
       'gosize': this.goSize, 
       'goarticle': this.goArticle, 
       'gogender': this.goGender, 
       'goprofile': this.goProfile, 
       scope: this 
      } 
     }); 
    }, 


    goLocale: function(link){ 
     console.log('locale clicked'); 
     console.dir(link); 
    }, 


    goBrand: function(link){ 
     console.log('brand clicked'); 
     // Also tried: 
     // var viewport = this.getView('Viewport').create(); 
     var viewport = link.up('viewport'); 
     console.dir(viewport); 
    }, 

콘솔 오류가

MyApp.controller.Navigation.addListener(): The specified callback function is undefined 
+1

다른 방법은 어디에 있습니까? 'goSize','goArticle' 등? 이것이 예외를 던지고있는 이유 일 수 있습니다. –

답변

0

노호 당신은 당신의 기능 "컨트롤"개체에 제공하고 있습니다.

그 객체 안에는 this이 더 이상 객체가 아니라 객체를 가리 킵니다. 시도해보십시오

init: function(application){ 
    console.log('controller init'); 
    var me = this; // "me" is scope to controller 
    this.control({ 
     'navigation': { 
      'golocale': me.goLocale, 
      'gobrand': me.goBrand, 
      'gosize': me.goSize, 
      'goarticle': me.goArticle, 
      'gogender': me.goGender, 
      'goprofile': me.goProfile, 
      scope: me 
     } 
    }); 
관련 문제