Wenas me respondo yo mismo por si acaso le sirve a alguien, ya lo resolvi, solo modifique esta linea:
Código PHP:
buildMenu(sb, arrayobjmenu, bean.pantalla,bean.nivel,arraytmpmenu);
cambiandola a :
Código PHP:
sb+= buildMenu(sb, arrayobjmenu, bean.pantalla,bean.nivel,arraytmpmenu);
Código PHP:
function buildMenu(sb,arrayobjmenu,id,level,arraytmpmenu){
sb="";
arrayobjmenu.forEach(function(bean){
if (bean.padre===id) {
if(bean.nivel==1){
sb+="<li >";
sb+="<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" role=\"button\" aria-expanded=\"false\">";
sb+=bean.titulomenu;
sb+="<span class=\"caret\" ></span></a>";
//var sizelst =0;
var sizelst = has_childrenSize(arrayobjmenu, bean.pantalla, arraytmpmenu);
//var bol=has_children(arrayobjmenu,bean.pantalla);
sb+= (sizelst>0)?"<ul class=\"dropdown-menu multi-level\" role=\"menu\" aria-labelledby=\"dropdownMenu\">":"";
console.log("si idpan"+bean.pantalla+" tine "+sizelst);
}else if(bean.nivel==2){
console.log('nivel 2');
//var sizelst =0;
var sizelst = has_childrenSize(arrayobjmenu, bean.pantalla, arraytmpmenu);
//var bol=has_children(arrayobjmenu,bean.pantalla);
console.log("si idpan"+bean.pantalla+" tine "+sizelst+' lev'+bean.nivel);
sb+= (sizelst>0)?"<li class=\"dropdown-submenu\">":"<li>";
sb+= (sizelst==0)?"<a href=\"#\" "+((bean.ruta=="#")?">":"onclick=abrirPagina(\""+bean.ruta+"\") >"):"<a tabindex=\"-1\" href=\"#\">";
sb+=bean.titulomenu;
sb+="</a>";
sb+= (sizelst>0)?"<ul class=\"dropdown-menu\">":"";
}else if(bean.nivel==3){
console.log('nivel 3');
sb+="<li >";
sb+="<a tabindex=\"-1\" >";
sb+=bean.titulomenu;
sb+="</a>";
}
arraytmpmenu.length=0;
console.log(bean.pantalla);
sb+= buildMenu(sb, arrayobjmenu, bean.pantalla,bean.nivel,arraytmpmenu);
if(bean.nivel==2 ){
//var sizelst =0;
var sizelst = has_childrenSize(arrayobjmenu, bean.pantalla, arraytmpmenu);
//var bol=has_children(arrayobjmenu,bean.pantalla);
sb+= (sizelst>0)?"</ul>":"";
console.log("si idpan r"+bean.pantalla+" tine "+sizelst);
sb+=("</li>");
}
else if(bean.nivel==1){
//var sizelst =0;
var sizelst = has_childrenSize(arrayobjmenu, bean.pantalla, arraytmpmenu);
//console.log("si idpan"+bean.pantalla+" tine "+sizelst);
sb+= (sizelst==0)?"</li>":"</ul></li>";
}else if(bean.nivel==3){
sb+="</li>";
}
}
});
return sb;
//console.log('menu: '+sb);
}
document.getElementById('m_menu').innerHTML = buildMenu(sb,arraylst,"0",1,arrlis);
Y en el html lo pinte
Código PHP:
[HTML]
<ul id="m_menu"></ul>
[/HTML]