DojoMenuRenderer not rendering correctly and throwing off the rest of the xpage if the menu is at the top. Seems there is an omitted comma when a custom styleClass or custom style have been applied to the menu. It works fine when no custom style, styleClass has been applied. There is a boolean value "hasp" that is marked as false that is used to append the comma to the script StringBuilder variable. Below is the code fragment w/ my temp. fix applied, and the .css I'm using for the menu.
if(component!=null) {
// boolean hasp = false;
String style = (String)component.getAttributes().get("style");// $NON-NLS-1$
if(StringUtil.isNotEmpty(style)) {
script.append(',');
// if(hasp) script.append(","); else hasp=true;
script.append("style:");// $NON-NLS-1$
JavaScriptUtil.addString(script, style);
}
String styleClass = (String)component.getAttributes().get("styleClass");// $NON-NLS-1$
if(StringUtil.isNotEmpty(styleClass)) {
script.append(',');
// if(hasp) script.append(","); else hasp=true;
JavaScriptUtil.addString(script, "class");//$NON-NLS-1$
script.append(":");// $NON-NLS-1$
JavaScriptUtil.addString(script, styleClass);
}
}
css entry used in the app where the bug surfaced after upgrading to 9.0.1.
/* Menus */
.customStyle .dijitReset .dijitMenuItem {
background: none repeat scroll 0 0 white;
}
.customStyle.dijitReset .dijitMenuItem .dijitMenuItemLabel {
color: black;
}
.customStyle.dijitMenu .dijitReset .dijitMenuSeparator {
background-color: white;
}
.customStyle.dijitMenu .dijitReset .dijitMenuSeparator .dijitMenuSeparatorTop
{
margin: 0px 0px 0px 0px;
border-bottom: black 1px solid;
}
.customStyle.dijitMenu .dijitMenuItemSelected {
background-color: #D8D8D8 !important;
}
.customStyle.dijitMenu .dijitMenuItemSelected .dijitMenuItemLabel {
color: black !important;
}