extjs 方法执行顺序_extjs中Ext.app.Controller的init方法和onLaunch方法的执行顺序。

答案:先执行init()方法,再执行onLaunch()方法。

引自:

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.app.Controller-method-onLaunch

onLaunch(

application )

TEMPLATE

A template method like init, but called after the viewport is created. This is called after the launch method of Application is executed.

Available since: 4.0.0

This is a template method. a hook into the functionality of this class. Feel free to override it in child classes.

Parameters

application : Ext.app.Application

例子如下:

Ext.define('cdkj.controller.correct.CorrectionEndController', {

extend : 'Ext.app.Controller',

views : [

'correct.end.CorrectionEndListView',

'correct.end.CorrectionEndContainer',

'common.DeptTreePanel',

'common.ListToolbar',

'correct.end.CorrectEndButton',

'correct.end.CorrectionEndSearchView',

//           'sys.BaseSearchPanel',

//           'common.DictionaryCombo'

'correct.end.CorrectEndSearchMoreWin',

'common.DictionaryCombo',

'correct.end.CorrectEndAddLayer',

'correct.end.CorrectEndTabContainer'

],

stores : [ 'correct.CorrectionEndStore',

'correct.ArchiveStore', 'common.DeptTreeStore'

,'common.DictionaryComboStore'

],

models : [ 'correct.CorrectionEndModel',

'correct.ArchiveModel', 'common.DeptModel'

,'common.ComboxModel'

],

//便于获取组件,名字为与别名相同,下面可以直接用getXXX()方法,类似Ext.ComponentQuery.query()功能。

refs :[{ref:'correctCorrectionEndContainer',selector:'correctCorrectionEndContainer'},

{ref:'correctCorrectionEndListView',selector:'correctCorrectionEndContainer correctCorrectionEndListView'},

{ref:'deptTreePanel',selector:'correctCorrectionEndContainer deptTreePanel'},

{ref:'listToolbar', selector:'listToolbar'},

//

//          {ref:'sysBaseSearchPanel', selector:'sysBaseSearchPanel'}

{ref:'correctionEndSearchView', selector:'correctionEndSearchView'},

//      {ref:'correctEndSearchMoreWin', selector:'correctEndSearchMoreWin'},

{ref:'correctEndSearchMoreWin',

selector:'correctCorrectionEndListView correctEndSearchMoreWin#message-moresearch-view',

xtype : 'correctEndSearchMoreWin',

autoCreate : true

}

],

init : function() {

alert(111);

this.control({

'correctCorrectionEndContainer deptTreePanel' : {// 绑定部门树的单击事件

itemclick : this.loadCorrectionEndTree

},

'correctCorrectionEndListView button[action=add]' : {// 绑定新增按钮

click : this.addCorrectionEnd

},

'correctCorrectionEndListView button[action=search]' : {// 绑定查询按钮

click : this.searchCorrectionEnd

},

'correctCorrectionEndListView button[action=export]' : {// 绑定导出按钮

click : this.exportCorrectionEnd

},

'correctCorrectionEndListView button[action=more]' : {// 绑定更多按钮

click : this.showMoreAction

},

'correctCorrectionEndListView button[action=search-more]' : {// 绑定更多搜索按钮

click : this.searchMoreCorrectionEnd

}

});

},

onLaunch:function(container){

alert(222);

var panel = Ext.widget('correctCorrectionEndContainer');

container.add(panel);

//        var correctionEndStore = this.getCorrectCorrectionEndListView().store;

//        correctionEndStore.reload();

}

}

///

以上例子先弹窗:

alert(111);

再弹窗:

alert(222);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值