Extjs控制器定义内部导航

时间:2016-07-27 19:31:58

标签: javascript 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 个答案:

答案 0 :(得分:0)

您提供的功能"控制"一个对象。

在该对象内,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 } }); 指向对象,而不是指向控制器。请尝试

SELECT emp_id,firstname,designation,full_address,gender,land,monthly_sal
FROM employee_reg where (emp_id = '...' or firstname LIKE '%');