-
FEATURED COMPONENTS
First time here? Check out the FAQ!
We need to set the style property of MenuItem label through java class. For the we are taking the MenuItem object through its id and setting the style to the menuitem through .setStyle method of MenuItem. But its not able to set style to the MenuItem label because style is set to li tag rather than span tag. Component component = view.getFellowIfAny(fieldId); MenuItem menuItem = (MenuItem) component; if (menuItem != null) { menuItem.setStyle(style); }
Hi nirmalmandhata, Welcome to ZK forum.
You can add custom classes to your components through sclass: https://www.zkoss.org/wiki/ZK%20Style%20Customization%20Guide/ZK%20CSS%20Class%20Design/Sclass
From there, just open your developer tools and look at the DOM tree:
myComponent.setSclass("myCustomCssClass");
will roughly render as:
<li id="xyz" class="z-menuitem myCustomCssClass">
<a href="javascript:;" id="zyz-a" class="z-menuitem-content">
<img src="yourimage.png" class="z-menuitem-image" align="absmiddle">
<span class="z-menuitem-text">Save All</span>
</a>
</li>
Result will depend on your code, but at this point you just need to apply a bit of css to style the inner span. The code will depend on how you write it, but the general idea should be similar too:
.myCustomCssClass span{
//style here!
}
Asked: 2016-09-05 05:47:10 +0800
Seen: 23 times
Last updated: Sep 06 '16