浏览 1326 次
|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
时间:2007-12-27
在使用Ext2.0布局的时候,在左边栏的链接点击的时候内容出现在右边布局里,这事件如何处理?
声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
时间:2007-12-27
我开始也被这个问题困扰,看子API以后,解决了,希望我的代码对你有帮助.
/**
*Common Java Scripts
*/
Ext.BLANK_IMAGE_URL = 'scripts/ext/resources/images/vista/s.gif';
var Home={
init : function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
var viewport = new Ext.Viewport({
layout:'border',
items:[new Ext.BoxComponent({ // raw
region:'north',
el: 'north',
height:32
}),{
region:'west',
id:'west-panel',
title:'West',
split:true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins:'35 0 5 5',
cmargins:'35 5 5 5',
layout:'accordion',
layoutConfig:{
animate:true
},
items: [
{
title:'Home Navigation',
autoScroll:true,
border:false,
iconCls:'nav',
html:'<div id="tree-viewer" style="overflow:auto;height:400px;border:0px solid #c3daf9;"></div>'
}
,{
title:'Settings',
html: '<p>Set The System Property</p>',
border:false,
autoScroll:true,
iconCls:'settings'
}]
},{
region:'center',
margins:'35 5 5 0',
layout:'fit',
autoScroll:false,
items:[{
baseCls:'x-plain',
layout:'fit',
// columnWidth:1,
bodyStyle:'padding:5px 5px 5px 5px',
items:[{
autoScroll:false,
// title: 'Content',
html: '<iframe id="content-iframe" frameborder="no" style="width:100%;height:94%"></iframe>'
// <p><iframe id="content-iframe" frameborder="no" style="width:100%;height:100%"></iframe></p>
}]
}]
}]
});
/**
*----------------------------------------------------------
*Start Tree Define
*Define tree Struct
*Tree Define By Song Hai Peng
*----------------------------------------------------------
*/
var Tree = Ext.tree;
var tree = new Tree.TreePanel(
{
el:'tree-viewer',
autoScroll:true,
animate:true,
enableDD:true,
containerScroll: true,
loader: new Tree.TreeLoader({
dataUrl:'/faceye/treeAction.do?method=tree'
})
}
);
//Defint node click event,when node is clicked,send data to inner 'div' and show data in
// set the root node
var root = new Tree.AsyncTreeNode({
text: 'Common Platform',
draggable:false,
id:'source'
});
tree.setRootNode(root);
/**
*Open node URL in a target contanier
*/
tree.on('click', function (node){
if(node.isLeaf()){
Ext.get('content-iframe').dom.src = node.attributes.link+'&node='+node.id;
//define grid;
return true;
}else{
/**
*open node by single click,not double click.
*/
node.toggle();
}
});
// render the tree
tree.render();
root.expand();
}
};
|
|
| 返回顶楼 | |
|
时间:2007-12-27
其中最关键的,是在生成layout时加入这一句:
<iframe id="content-iframe" frameborder="no" style="width:100%;height:94%"></iframe> 同时,在树节点的click事件中: # tree.on('click', function (node){ # if(node.isLeaf()){ # Ext.get('content-iframe').dom.src = node.attributes.link+'&node='+node.id; # //define grid; # return true; # }else{ # /** # *open node by single click,not double click. # */ # node.toggle(); # } # }); 指定节点在iframe中显示 |
|
| 返回顶楼 | |





![ecsun的博客: [海鹏Blog]--{FaceYe开源} 用户头像](http://www.javaeye.com/upload/logo/user/36668/bcfaff38-8200-4288-88e6-f588c3138e36.gif?1196653519)