Spark Menu Disable Style
-
- Posts: 41
- Joined: 19 Jun 2013, 00:54
I am populating Spark layout menu from model POJO. During this based on some creteria I had disabled few menu element at leaf level. Which works !!!. But the problem is that there style remains unchanged meaning the disabled and enable menu element style remain same which is kind of a problem from user experience point of view.
PrimeFaces 5.3 | Spark 2.1 | Wildfly 10.0 | Mojarra 2.2.0 | Eclipse | Prime Faces Extension 3.2.0 | Omnifaces 2.0 | Java 1.8
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
A few menuItem is disabled="true" in ps:menu. Right?
Exp;
Exp;
Code: Select all
<ps:menu>
<p:submenu label="Spark Theme" icon="fa fa-rocket">
<p:menuitem value="Forms" icon="fa fa-file-text-o" outcome="forms" />
<p:menuitem value="Misc" icon="fa fa-stack-overflow" outcome="misc" disabled="true" />
</p:submenu>
...
Github Profile: https://github.com/mertsincan
-
- Posts: 41
- Joined: 19 Jun 2013, 00:54
Right. The expectation is the disabled style should apply for disabled menu elements When element is disabled from bean or page.
From xhtml
From bean
From xhtml
Code: Select all
<p:menuitem value="Misc" icon="fa fa-stack-overflow" outcome="misc" disabled="true" />
From bean
Code: Select all
leafNode.setDisabled(true);
subMenu.addElement(leafNode);
PrimeFaces 5.3 | Spark 2.1 | Wildfly 10.0 | Mojarra 2.2.0 | Eclipse | Prime Faces Extension 3.2.0 | Omnifaces 2.0 | Java 1.8
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks for the sample. I've replicated the issue. I think you can try with this changes;
- please change in encodeMenuItem function of SparkMenuRenderer;
- please add the css code in your layoutmenu.xhtml or spark-layout-* file;
We will add a similar solution for next version.
- please change in encodeMenuItem function of SparkMenuRenderer;
Code: Select all
protected void encodeMenuItem(FacesContext context, AbstractMenu menu, MenuItem menuitem, int marginLevel) throws IOException {
...
String styleClass = "Animated05";
if(marginLevel >= 1) {
styleClass = styleClass + " menuLevel" + marginLevel;
}
if(disabled) { // Added
styleClass = styleClass + " ui-state-disabled";
}
writer.startElement("a", null);
....
Code: Select all
<style type="text/css">
#layout-menu li ul li a.ui-state-disabled {
background-color: transparent !important;
color: #778d9b !important;
}
#layout-menu li ul li:hover > a.ui-state-disabled {
background-color: transparent !important;
color: #778d9b !important;
}
</style>
We will add a similar solution for next version.
Github Profile: https://github.com/mertsincan
-
- Posts: 4
- Joined: 27 Mar 2014, 09:57
still not in the current version of spark 2.1.2
I need this fix and you promised to include it in next release.
I need this fix and you promised to include it in next release.
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Sorry, I added this fix into next version; https://github.com/primefaces/layouts/issues/138
Github Profile: https://github.com/mertsincan
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
You're welcome!
Github Profile: https://github.com/mertsincan
Long been looking for this information, thank you guys for the post!!!
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Thanks
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 17 guests