|
|
/**
|
|
|
* Created by frw on 2016/6/17.
|
|
|
*/
|
|
|
|
|
|
var selectedNodeId = null;
|
|
|
|
|
|
var treeData = [];
|
|
|
var nodeId2id = function (nodeid) {
|
|
|
if (nodeid == "#") {
|
...
|
...
|
@@ -141,9 +144,23 @@ $("#btn4type").click(function () { |
|
|
/**
|
|
|
* 根据选中的节点获取信息
|
|
|
*/
|
|
|
function searchType(ip){
|
|
|
function searchType(ip, children, nodeId){
|
|
|
|
|
|
//非叶子节点不处理
|
|
|
if(children.length != 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//将原来选中的节点的背景颜色去掉
|
|
|
if(selectedNodeId != null) {
|
|
|
document.getElementById(selectedNodeId).style.backgroundColor="transparent";
|
|
|
}
|
|
|
|
|
|
//给选中的节点添加背景颜色
|
|
|
document.getElementById(nodeId).style.backgroundColor="#CCCCCC";
|
|
|
selectedNodeId = nodeId;
|
|
|
|
|
|
$("#detailTable").hide();
|
|
|
// $("#rootTable").table("load",{});
|
|
|
$("#rootTable").table({
|
|
|
url: contextPath + "/zkTree/getRoot?ip="+ip,
|
|
|
striped: true,
|
...
|
...
|
@@ -185,7 +202,6 @@ function searchType(ip){ |
|
|
}
|
|
|
}],
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -280,7 +296,7 @@ var refreshTypeTree = function () { |
|
|
|
|
|
|
|
|
$('#jstree').jstree({
|
|
|
"plugins": ["themes", "checkbox", "contextmenu", "ui", "types", "crrm", "core", "status"],
|
|
|
"plugins": ["themes", "contextmenu", "ui", "types", "crrm", "core", "status"],
|
|
|
'core': {
|
|
|
"themes": {
|
|
|
name: 'proton',
|
...
|
...
|
@@ -292,8 +308,8 @@ $('#jstree').jstree({ |
|
|
}
|
|
|
}).bind("changed.jstree",
|
|
|
function (e, data) {
|
|
|
console.log(data);
|
|
|
console.log(data);
|
|
|
console.log("Checked: " + data.node.text);
|
|
|
searchType(data.node.text);
|
|
|
searchType(data.node.text, data.node.children, data.node.a_attr.id);
|
|
|
});
|
|
|
refreshTypeTree(); |
...
|
...
|
|