Dear DHX Team,
We would like to use the DHTMLX Menu and set item images.
The problem is that the icons are not displaying properly although the path is correct. The icons are on the same plane.
code:
setItemImage(“artikel_erstellen”,“new.gif”,“new.gif”);
Thank you very much, I really appricate your assistants.
Regards,
Ersin Kaplan
Hello,
please, check the sample in the menu package dhtmlxMenu/samples/04_items/08_images.html, possibly it’ll help to solve the issue (on the website dhtmlx.com/docs/products/dhtmlxM … mages.html).
If the issue can not be resolved, please provide the complete demo.
I’ve looked at it but
please provide the complete demo
function createHeadermenu ($variable,$attribute)
{
$array = array();
$array[‘design’] = ’ //ROOT
var ‘.$variable.’ = dhxLayout.attachMenu();
‘.$variable.’.setIconsPath("/imgs/");
‘.$variable.’.addNewSibling(null, “logout”, “Logout”, false); // adding the first item to the menu, “nextToId” param is null
‘.$variable.’.addNewSibling(null, “artikel”,"’.$attribute[‘artikel’].’", false); // adding the first item to the menu, “nextToId” param is null
‘.$variable.’.addNewSibling(null, “mainmanue”,"’.$attribute[‘hauptmenu’].’", false); // adding the first item to the menu, “nextToId” param is null
//Child
‘.$variable.’.addNewChild(“artikel”, 0, “artikel_erstellen”,"’.$attribute[‘artikel_erstellen’].’", false); // adding a new child item
‘.$variable.’.setHotKey(“artikel_erstellen”, “Ctrl+N”); // setting a hotkey to a button
‘.$variable.’.addNewSeparator(“artikel”); // adding a separator
‘.$variable.’.addNewChild(“artikel”, 0, “artikel_bearbeiten”,"’.$attribute[‘artikel_bearbeiten’].’", false); // adding a new child item
‘.$variable.’.setHotKey(“artikel_bearbeiten”, “Ctrl+u”); // setting a hotkey to a button
‘.$variable.’.addNewSeparator(“artikel”); // adding a separator
‘.$variable.’.addNewChild(“artikel”, 0, “artikel_suchen”,"’.$attribute[‘artikel_suchen’].’", false); // adding a new child item
‘.$variable.’.setHotKey(“artikel_suchen”, “Ctrl+z”); // setting a hotkey to a button
‘.$variable.’.addNewSeparator(“artikel”); // adding a separator
‘.$variable.’.setItemImage(“artikel_erstellen”,"/imgs/new.gif","/imgs/new.gif");
‘.$variable.’.setItemImage(“artikel_bearbeiten”,"/imgs/edit.gif","/imgs/new.gif");
‘.$variable.’.setItemImage(“artikel_suchen”,"/imgs/edit.gif","/imgs/new.gif");
‘.$variable.’.attachEvent(“onClick”, function(id, zoneId, casState){
/
alert(“element “+id+” was clicked”);
alert (document.cookie+“sahd”);
var sess = document.cookie;
/
switch(id)
{
case “logout”:
{
var des = confirm("’.$attribute[‘logout_meldung’].’");
if(des == true)
{
document.getElementById(“out”).submit();
loadLoader();
}
}
break;
case “artikel_erstellen”:
{
document.getElementById(“hiddenForm”).submit();
loadLoader();
}
break;
case “mainmanue”:
{
document.getElementById(“main”).submit();
loadLoader();
}
break;
case “artikel_suchen”:
{
document.getElementById(“artikel_suchen”).submit();
loadLoader();
}
break;
}
if (casState[“ctrl”] == true) {
// ctrl key was pressed with click
} else {
// ctrl key was not pressed with click
}
// alt
if (casState[“alt”] == true) {
// alt key was pressed with click
} else {
// alt key was not pressed with click
}
// shift
if (casState[“shift”] == true) {
// shift key was pressed with click
} else {
// shift key was not pressed with click
}
});
';
$array[‘div’] = ’
';
return $array;
}
Which menu version do you use ? there were actually issue with setItemImage and addNewChild(addNewSibling) in some previous version. There can not be issue in the 2.5 version.
The possible reason for teh problem is incorrect path. Do you take intoconsideration the path that you have defined in the setIconsPath method ?
Possibly the correct image path is setItemImage(“artikel_erstellen”,“new.gif”,“new.gif”) instead of setItemImage(“artikel_erstellen”,"/imgs/new.gif","/imgs/new.gif") ?
The provided snippet isn’t complete demo. So, please if the issue still occurs, please provide the sample ( dhtmlx.com/docs/support/what … d_demo.htm )
ah ok thanks