可以,但需要做一定的调整,本人对XLoadTree进行了扩展:
function _DMFXWebLoadTreeExpand(path, level) {
var thisLevel = path.indexOf('-', level)
var thisPath = "";
if (thisLevel > 0) {
thisPath = path.substring(0, thisLevel);
if (typeof(webFXTreeHandler.binds[thisPath]) == 'undefined') {
setTimeout("_DMFXWebLoadTreeExpand(\"" + path + "\", " + level + ");", 30);
return;
}
webFXTreeHandler.binds[thisPath].expand();
setTimeout("_DMFXWebLoadTreeExpand(\"" + path + "\", " + (thisLevel + 1) + ");" , 30);
}
else {
if (typeof(webFXTreeHandler.binds[path]) == 'undefined') {
setTimeout("_DMFXWebLoadTreeExpand(\"" + path + "\", " + level + ");", 30);
return;
}
thisPath = path.substring(level);
if (thisPath.charAt(0) == 'g') {
webFXTreeHandler.binds[path].expand();
} else {
webFXTreeHandler.selected.deSelect();
webFXTreeHandler.binds[path].select();
}
}
}其实思想很简单:
1. 你需要在每个节点中记录结点的路径:root-child-child-child....-child-child
2. 这样你可以不停的通过递归的方式展开了
function _DMFXWebLoadTreeExpand(path, level) {
var thisLevel = path.indexOf('-', level)
var thisPath = "";
if (thisLevel > 0) {
thisPath = path.substring(0, thisLevel);
if (typeof(webFXTreeHandler.binds[thisPath]) == 'undefined') {
setTimeout("_DMFXWebLoadTreeExpand(\"" + path + "\", " + level + ");", 30);
return;
}
webFXTreeHandler.binds[thisPath].expand();
setTimeout("_DMFXWebLoadTreeExpand(\"" + path + "\", " + (thisLevel + 1) + ");" , 30);
}
else {
if (typeof(webFXTreeHandler.binds[path]) == 'undefined') {
setTimeout("_DMFXWebLoadTreeExpand(\"" + path + "\", " + level + ");", 30);
return;
}
thisPath = path.substring(level);
if (thisPath.charAt(0) == 'g') {
webFXTreeHandler.binds[path].expand();
} else {
webFXTreeHandler.selected.deSelect();
webFXTreeHandler.binds[path].select();
}
}
}其实思想很简单:
1. 你需要在每个节点中记录结点的路径:root-child-child-child....-child-child
2. 这样你可以不停的通过递归的方式展开了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货