Show一下用Ext2做的示例.
1.关于首页及树的生成JS代码/Java代码 ** *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: },{ 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; var root; if(!tree){ var Tree = Ext.tree; 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 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(); } };***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: },{ 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; var root; if(!tree){ var Tree = Ext.tree; 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 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(); }};
页:
[1]