- 注册时间
- 2014-2-19
- 最后登录
- 2015-3-16
- 阅读权限
- 10
- 积分
- 58
- 精华
- 0
- 帖子
- 13
|
本帖最后由 boolean 于 2014-12-24 16:54 编辑
dforce 发表于 2014-12-24 16:17
都是标准方法怎么会不行
把你的数据和代码都贴出来
数据,enabeld自定义属性,
[
{id: "kantans", text: "勘探",enabeld:'false'},
{id: "Splitter1", text: "工作量1" , pid: "kantans",enabeld:'false'},
{id: "Splitter2", text: "工作量2" , pid: "kantans",enabeld:'false'},
{id: "Splitter3", text: "工作量3" , pid: "kantans",enabeld:'false'},
{id: "Splitter4", text: "工作量4" , pid: "kantans",enabeld:'false'},
{id: "Splitter5", text: "工作量5" , pid: "kantans",enabeld:'false'},
{id: "Splitter6", text: "工作量6" , pid: "kantans",enabeld:'false'},
{id: "Splitter7", text: "工作量7" , pid: "kantans",enabeld:'false'},
{id: "Splitter8", text: "工作量8" , pid: "kantans",enabeld:'false'},
{id: "Splitter9", text: "工作量9" , pid: "kantans",enabeld:'true'},
{id: "Splitter10", text: "工作量10" , pid: "kantans",enabeld:'true'}
]
方法
mini.parse();
$(document).ready(function() {
$.ajax({
type: "POST",
dataType:"html",
url:"model/searchModel.action",
success:function(strValue){
var menus = eval('(' + strValue + ')');
var menudiv = $("#menu");
var menustr = "";
$.each(menus,function(n,value){
$.each(value,function(k,v){
menustr += "<a class=\"mini-button mini-button-iconTop mini-button-plain\" href=\"javascript:searchTree('"+k+"','"+v+"')\"><span class=\"mini-button-text \" style=\"\">"+v+"</span></a>";
});
});
menudiv.append(menustr);
},
error:function(){
alert("调用出错");
}
});
});
//上面是导航菜单加载,每个导航菜单点击事件加载树,如下
function searchTree(code,name){
var tree = mini.get("leftTree");
tree.setUrl("model/searchSortTree.action?name_model="+name+"&code_model="+code);
debugger;
var codenode = tree.getNode(code);//获取为空
var nodes = tree.getChildNodes(codenode);//报方法不存在
alert(nodes);
$.each(nodes,function(n,node){
if(node.enabeld=="true"){
alert(node.name);
}
});
}
|
|