jquery easy ui combox

时间:2021-02-12 03:46:49

$(document).ready(function() {
$.ajax({
type: 'POST',
dataType: "json",
url:'menu/getAll',
success: function(data){
$.each(data,function(i,n){
$('#menu').accordion('add',{
title: n.menu_name,
selected: false,
content:'<div style="padding:10px"><ul name="'+n.menu_name+'"></ul></div>',
});
});
}
});

$('#menu').accordion({
onSelect: function(title,index){
$("ul[name='"+title+"']").tree({
url: 'menu/getModules?menuName='+title,
});
alert(title);
}
});
});

<body id="cc" class="easyui-layout">
<div data-options="region:'north'" style="height: 100px"></div>
<div data-options="region:'west',title:'导航菜单'" style="width: 200px;">
<div id="menu" class="easyui-accordion">
</div>
</div>
<div data-options="region:'center'">

</div>
</body>