Ext4的MVC结构如何抽取公用组件

来源:互联网 发布:千牛mac电脑版 编辑:程序博客网 时间:2024/05/24 07:15
Ext.define("Component.controller.CommonController", {    extend: 'Ext.app.Controller',    refs:[        //搜索Form的ID需要是searchForm         { ref : 'searchForm', selector: '#searchForm'}    ],    selectQueryCondition : function (comboxName) {        var combobox = this.getSearchForm().getForm().findField(comboxName);        var comboboxStore = combobox.getStore();        comboboxStore.load({            scope: this,            callback: function(records, operation, success) {                combobox.select(comboboxStore.getAt(0));                var searchForm = this.getSearchForm().getForm();                //需要子类继承并实现                this.reloadBySearchCondition(searchForm.getValues());            }        });    },    getCurrentItemCombobox : function(comboxName) {        var queryComBoBox = this.getSearchForm().getForm().findField(comboxName);        if (queryComBoBox != null) {          return queryComBoBox.store.findRecord("code", queryComBoBox.getValue());        }    }})

注重细节,注重命名约定,注意方法的继承和使用,如果需要继承这个Controller,需要在html文件中引用这个js文件,并在app.js中加入:
   paths:{      Component : '../../Component.app/'   }
0 0
原创粉丝点击