问题描述
我的网页上的Dynatree运行良好.我正在使用initAjax来获取结构.当我生成json时,我会在适当的位置包括 "select":true 来选中复选框.大多数(所有)复选框都位于从根目录开始向下三级的深度.
I have Dynatree running well on my page. I am using an initAjax to get the structure. When I generate my json I include "select": true where appropriate to select check-boxes. Most (all) of the check-boxes are at a depth of three levels down from the root.
我想扩展所选节点的父级,以便用户在页面加载时可以看到所选复选框.
I would like to expand the parents of the selected nodes so the user can see the selected check-boxes when the page loads.
我认为我需要对getPostedNodes的onPostInit函数进行操作,但是我无法确定代码?我不确定是否应该使用each语句遍历所选节点?任何帮助将不胜感激!
I think I need to do something on the onPostInit function with getSelectedNodes, but I can not nail down the code?? I'm not sure if I should be using a each statement to loop through the selected nodes? Any help would be greatly appreciated!
-更新-
我知道了!
onPostInit: function(isReloading, isError) {
var tree = $('#tree').dynatree('getTree');
var selKeys = $.map(tree.getSelectedNodes(), function(node){
node.makeVisible();
});
}
推荐答案
响应时间略短:
onPostInit: function() {
$.map(this.getSelectedNodes(), function(node){
node.makeVisible();
});
}
这篇关于Dynatree展开选定节点的父级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!