标签:style blog io color os sp java on div
<div id="menu"> </div>
1 <script type="text/javascript"> 2 $.ajax({ 3 url:Thinkphp[‘MODULE‘] + ‘/Index/getTree‘, 4 type:‘post‘, 5 success:function(data){ 6 $.each(data,function(i,n){ 7 $(‘#menu‘).accordion(‘add‘,{ 8 title: n.text, 9 selected: false, 10 content:‘<div style="padding:0 0 0 10px;"><ul name="‘+n.text+‘"></ul></div>‘, 11 }); 12 }); 13 }, 14 }); 15 $(‘#menu‘).accordion({ 16 fit:true, 17 border:false, 18 onSelect:function(title,index){ 19 $("ul[name=‘"+title+"‘]").tree({ 20 lines:true, 21 url: Thinkphp[‘MODULE‘] + ‘/Index/getTree/Name/‘+encodeURI(title), 22 }); 23 console.info(title) 24 }, 25 }); 26 </script>
easyui的accordion为动态生成,accordion的onSelect方法中又动态生成tree,为什么要第二次选择accordion,tree才生成出来
标签:style blog io color os sp java on div
原文地址:http://www.cnblogs.com/cms100/p/4150943.html