EasyUI 加载Tree
function LoadTree(result) { mainMenu = $('#mainMenu').tree({ url: "/ajax/GetTreeJson.ashx", parentField: 'pid', animate: true, onLoadError: function () { $.messager.alert('提示', '加载失败,请重试', 'error'); }, onLoadSuccess: function (node, data) { SetSetting(result); // mainMenu.tree('collapseAll'); }, onClick: function (node) { if (node.attributes.url) { var tabs = $('#worktab'); var src = node.attributes.url + "&NowDateTimeSign =" + Math.random(); var isreloadid = node.attributes.isreloadid; var opts = { title: node.text, closable: true, iconCls: node.iconCls, content: '<iframe id="ifm_frame" src="' + src + '" allowTransparency="true" style="border:0;width:100%;height:99%;" frameBorder="0"></iframe>', border: false, fit: true, id: isreloadid//暂时将是否重新刷新页面放在ID上 }; if (tabs.tabs('exists', opts.title)) { tabs.tabs('select', opts.title); //判断是否重新加载数据 if (isreloadid == "2") { var tab = tabs.tabs('getSelected'); tabs.tabs('update', { tab: tab, options: { title: opts.title, content: opts.content } }); } } else { tabs.tabs('add', opts); tabClose(); tabCloseEven(); } } else { if (node.state=='closed') { mainMenu.tree("expand", node.target); } else { mainMenu.tree("collapse", node.target); } } } }); $("#worktab").tabs({ onSelect: function (title, index) { var target = this; var pp = $(target).tabs('getSelected'); var tab = pp.panel('options'); if (tab.id == "2") { $(target).tabs('update', { tab: pp, options: { title: tab.title, content: tab.content } }); } } }); }