//添加新的手风琴风格菜单
function addMenu(data, sysName) {
var menuList = "";
//回圈全部模组菜单讯息
$.each(data, function (i, objOne) {
menuList = "
";
//回圈某个模组下所有菜单讯息
$.each(objOne.MenuInfo, function (j, objTwo) {
if (objTwo.PackageUrl != "") {
menuList += " - " + objTwo.MenuName + "
";
}
else {
menuList += " - " + objTwo.MenuName + "
";
}
});
menuList += "
";
$('#divMenuDetail').accordion('add', {
title:
" + objOne.MenuModelName + "", //菜单模组名称
content: menuList, //本模组菜单清单
selected: false
});
});
var pp = $('#divMenuDetail').accordion('panels');
var t = pp[0].panel('options').title;
$('#divMenuDetail').accordion('select', t);
}
这是我自己用的easyUI动态生成两层菜单前台JS方法
你需要用ajax去后台抓出两层菜单传到前台,objOne是第一层,objTwo是第二层,参考一下