extjs的controller为什么要加载所有的mvc
1个回答
2017-05-10 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
var application;
Ext.tip.QuickTipManager.init();
Ext.Loader.setConfig({
disableCaching:true,
enabled: true
});
application =new Ext.application({
requires: [
'Ext.window.MessageBox',
'Ext.container.Viewport'
],
name: 'app',
appFolder:'js/xxx/app',
autoCreateViewport:false,
controllers: [
'frameController'
],
launch: function() {
Ext.widget("main_viewport");
}
});
function refresh4Session()
{
Ext.Ajax.request({url: GLOBAL_ROOT_PATH+'/blank.jsp'});
setTimeout(refresh4Session,5*60*1000);//五分钟
}
refresh4Session();
Ext.define('app.controller.frameController',{
extend : 'Ext.app.Controller',
alias : 'controller.frameController',
views : ['Viewport'],
refs:[
{ref:'tabpanel',selector:'main_viewport>tabpanel[id=tabpanel]'}
],
init : function(application) {
var me = this;
window.application=me.getApplication();
me.control({
'main_viewport>panel[region=west]':{
render:function(obj){
var treepanel=Ext.create('Ext.tree.Panel',{
title:'test',
autoHeight:true,
autoScroll: true,
split: true,
rootVisible:false,
lines:true,
store: Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{text: '菜单名称', page: 'xxxxInfo_List', controller_full_class_name:'app.controller.xxxxInfo',leaf: true},
{text: '菜单名称', page: 'xxxxLevel_List',controller_full_class_name:'app.controller.xxxxLevel',leaf: true}
]
}
}),
listeners: {
'itemclick': function(view, record){
if (!Ext.ClassManager.isCreated(record.raw.controller_full_class_name)) {
me.getApplication().getController(record.raw.controller_full_class_name);
}
if(record.isLeaf()){
var id = 'tab-' + record.internalId;
var center = me.getTabpanel();//view.up('viewport').down('tabpanel');
var tab = center.queryById(id);
if(!tab){
tab = center.add(Ext.widget(record.raw.page, {itemId: id, title: record.get('text'),closable : true}));
}
center.setActiveTab(tab);
}
}
}
});
Ext.tip.QuickTipManager.init();
Ext.Loader.setConfig({
disableCaching:true,
enabled: true
});
application =new Ext.application({
requires: [
'Ext.window.MessageBox',
'Ext.container.Viewport'
],
name: 'app',
appFolder:'js/xxx/app',
autoCreateViewport:false,
controllers: [
'frameController'
],
launch: function() {
Ext.widget("main_viewport");
}
});
function refresh4Session()
{
Ext.Ajax.request({url: GLOBAL_ROOT_PATH+'/blank.jsp'});
setTimeout(refresh4Session,5*60*1000);//五分钟
}
refresh4Session();
Ext.define('app.controller.frameController',{
extend : 'Ext.app.Controller',
alias : 'controller.frameController',
views : ['Viewport'],
refs:[
{ref:'tabpanel',selector:'main_viewport>tabpanel[id=tabpanel]'}
],
init : function(application) {
var me = this;
window.application=me.getApplication();
me.control({
'main_viewport>panel[region=west]':{
render:function(obj){
var treepanel=Ext.create('Ext.tree.Panel',{
title:'test',
autoHeight:true,
autoScroll: true,
split: true,
rootVisible:false,
lines:true,
store: Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{text: '菜单名称', page: 'xxxxInfo_List', controller_full_class_name:'app.controller.xxxxInfo',leaf: true},
{text: '菜单名称', page: 'xxxxLevel_List',controller_full_class_name:'app.controller.xxxxLevel',leaf: true}
]
}
}),
listeners: {
'itemclick': function(view, record){
if (!Ext.ClassManager.isCreated(record.raw.controller_full_class_name)) {
me.getApplication().getController(record.raw.controller_full_class_name);
}
if(record.isLeaf()){
var id = 'tab-' + record.internalId;
var center = me.getTabpanel();//view.up('viewport').down('tabpanel');
var tab = center.queryById(id);
if(!tab){
tab = center.add(Ext.widget(record.raw.page, {itemId: id, title: record.get('text'),closable : true}));
}
center.setActiveTab(tab);
}
}
}
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询