日期:2014-05-16 浏览次数:20394 次
Ext.namespace("treeCommon"); var groupTreeSelected = "1"; var root = new Ext.tree.AsyncTreeNode( { id : "root", text : "树的根" }); treeCommon.group_tree = new Ext.tree.TreePanel( { id : 'group_tree', root : root, height : 500, autoScroll : true, border : true, rootVisible : false, autoWidth : true, tools:[{ id:'refresh', on:{ click:function(){ treeCommon.tree_refresh();//调用刷新的函数 } } }], loader : new Ext.tree.TreeLoader( { dataUrl : '../../js/item/getTree.jsp' }), listeners : { 'click' : function(node, event) { event.stopEvent(); groupTreeSelected = node; var n = tab.getComponent(node.id); if (!n) { // 判断是否已经打开该面板 if (node.leaf == true) { groupTreeSelected.select(); n = tab.add( { 'id' : node.id, 'title' : node.text, closable : true, // 通过html载入目标页 html : '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src=../../jsp/item/toGroupRst.jsp?code=' + node.id + '></iframe>' }); } } tab.setActiveTab(n); } } }); treeCommon.tree_ref=function(){ groupTreeSelected.parentNode.reload(); }; treeCommon.tree_refresh=function(){ var tree = Ext.getCmp('group_tree'); var loader = new Ext.tree.TreeLoader({dataUrl : '../../js/item/getTree.jsp'}); loader.load(tree.root); };
treeCommon.groupTreeSelected = "1";