首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

ext单页面兑现框架页

2012-10-07 
ext单页面实现框架页}] ?})??var _tree new Ext.tree.TreePanel({?? ? ? ?id:forum-tree,?? ? ? ?reg

ext单页面实现框架页

}] ?

});?

?

var _tree = new Ext.tree.TreePanel({

?? ? ? ?id:'forum-tree',

?? ? ? ?region:'west',

?? ? ? ?title:'功能菜单',

?? ? ? ?split:true,

?? ? ? ?width: 325,

?? ? ? ?minSize: 175,

?? ? ? ?maxSize: 400,

?? ? ? ?collapsible: true,

?? ? ? ?margins:'0 0 5 5',

?? ? ? ?rootVisible:false,

?? ? ? ?lines:false,

// ? selModel: new Ext.tree.MultiSelectionModel(),

?? ? ? ?autoScroll:true,

?? ? ? ?loader: dwrloader,

?? ? ? ?root: new Ext.tree.AsyncTreeNode({text:'root',hasChildren:true,id: '0'})

?? ? ? ?/*listeners: {

? ? ? ?'checkchange': function(node, checked){

? ? ? ? ? ?if(checked){

? ? ? ? ? ? ? ?node.getUI().addClass('complete');

? ? ? ? ? ?}else{

? ? ? ? ? ? ? ?node.getUI().removeClass('complete');

? ? ? ? ? ?}

? ? ? ?}

?? ?

});

}

contentPanel.setActiveTab(n);

?? ?});

*/

?

// 10-03-02 再次修改为tree.on方法 取消原来的在selectionmodel上做

/*

tree.on('click', function(node){

?? ? ? ?// 如果是叶子节点

if ( node.isLeaf() ){

// 得到节点对象Ext.tree.TreeNode

var n = contentPanel.getComponent(node.id);

// 如果不存在 在TabPanel上添加一个tab 挂载iframe页面

if(!n){

n = contentPanel.add({?

id:node.id, ?

title:node.text, ?

autoScroll:true,

closable:true, ?

html:'<iframe id="frame_main" src="'?

+ node.attributes.attributes.url?

+ '" mce_src="'?

+ node.attributes.attributes.url?

+ '" width="100%" height="400" frameborder="0" scrolling="auto"></iframe>'

});

}

// 激活

contentPanel.setActiveTab(n);

}

});

*/

// 10-03-15 再次修改 ?实验性修改为之加载外部文件js 不使用框架页了

tree.on('click', function(node){

myMask.show();

var nodeattr = node.attributes.attributes;

?? ? ? ?// 如果是叶子节点

if ( node.isLeaf() ){

// 获取这个模块的id

var moduleId = nodeattr.module_name;

var n = contentPanel.getComponent(moduleId);

// 如果不存在 在TabPanel上添加一个tab id为模块的id

if(!n){

// 如果数组里初始化过此module

if( moduleArray[moduleId] != undefined ){

var module = moduleArray[moduleId];

var moduleInstance = new module();

var outCmp = ?contentPanel.add(moduleInstance);

contentPanel.setActiveTab(outCmp);

myMask.hide();

}else{

// ?ajax请求 来eval一段module的代码 并执行 然后加到tabpanel上

Ext.Ajax.request({

method: 'GET',

url: nodeattr.js_source,

success: function(response){

var module = eval(response.responseText);

moduleArray[moduleId] = module;

var moduleInstance = new module();

var outCmp = ?contentPanel.add(moduleInstance);

contentPanel.setActiveTab(outCmp);

myMask.hide();

}

});

}

}

// 获取js代码的绝对路径

}

});

?

// 开始渲染整个面板 ?并整合定义好的tree和TabPanel组建

var viewport = new Ext.Viewport( {

layout : 'border',

items : [ {

xtype: 'box',

region: 'north',

height: 30

},

_tree,?

contentPanel

]

});

});

?

来自:http://hi.baidu.com/wastorode/blog/item/fdfd37aca0b588a3ca130c7a.html

?

?

?

热点排行