submenu's not displaying when using Dynamic loading

I am having issues with the submenus being displayed when I switch over to Dynamic Loading. Originally I was using;

dhxMenu = dhxLayout.cells(“a”).attachMenu();
dhxMenu.setIconsPath(“dhtmlxMenu/codebase/imgs/”);
dhxMenu.loadXML(“common/dhxmenu.xml?etc=” + new Date().getTime(), function() {});

And dhtmlxmenu.xml had the following structure;

<?xml version="1.0" ?>

This worked fine however I wanted to switch over to Dynamic Loading since each menu may contain various items depending on the site location. In my main program I changed the code to;

dhxMenu = dhxLayout.cells(“a”).attachMenu();
dhxMenu.setIconsPath(“dhtmlxMenu/codebase/imgs/”);
dhxMenu.enableDynamicLoading(“php/dhtmlxmenu2.php?sitename=VW_DE_Newark&etc=” + new Date().getTime());

and the dhtmlxmenu2.php file is as follows;

<?php require_once('config-4.php'); header("Content-type:text/xml"); echo '<?xml version="1.0"?>';

echo ‘’;

$thesitename = $_GET[‘sitename’];
$link = mysql_pconnect($mysql_host, $mysql_user, $mysql_pasw);
$db = mysql_select_db ($mysql_db);

$res = mysql_query (“SELECT DISTINCT l1nodeLbl FROM rothdna.nodeinfo WHERE siteName='”.$thesitename.“’ AND (l1nodeLbl LIKE ‘%Lighting%’ OR l1nodeLbl LIKE ‘%RTU%’) ORDER BY l1nodeLbl”);

while ($out = mysql_fetch_object($res)) {
if ($out->l1nodeLbl==“Lighting”){
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
} else {
echo ‘’;
}
}
mysql_free_result($res);
echo ‘’;
mysql_close($link);
?>

If I run just the PHP program with a sitename. For example;
…/php/dhtmlxmenu2.php?sitename=VW_MI_Flint

I get the following displayed;

<?xml version="1.0" ?>

The problem i am running into is when I bring up the web page I only get the Main items. i do not get the submenus. Attached is a screen shot of the Menu being display but again, if I move my mouse over to Lighting I do not get a drop down of Alarms, Configuration, etc.

Can anyone plesae let me know what I am missing?

Thank You,
Todd

Hi,

menu item that have subitems must have complex=“true” attribute. And tag of submenus should include parentId. Please check ready sample in the menu package:

dhtmlxMenu/samples/01_init/05_dynamic_loading.html

Dear all,

I’ve exactly the same issue and adding complex and ParentId is not working.

Please find therafeter the XML generated by the php script :

I may make a mistake but I can’t find out.

Thank you in advance for your help.

Regards,

Matthieu

mdoresse
Have you check the approch, which Alexandra has described?