Page 1 of 1

[BUG] Switch not working with enum

Posted: 26 Sep 2014, 01:34
by djmj
Switch is not working with implicit JSF enum support.
Nothing is renderd in example:

Code: Select all

public enum FooEnum
{
    A, B
}

public Bean
{
    private FooEnum = A;
}

Code: Select all

<pe:switch value="#{bean.fooEnum}" >
	<pe:case value="A">
		A
	</pe:case>
	<pe:case value="B">
		B
	</pe:case>
</pe:switch>

Re: [BUG] Switch not working with enum

Posted: 26 Sep 2014, 09:11
by tandraschko
feel free to create a feature request + pull request ;)

Re: [BUG] Switch not working with enum

Posted: 28 Nov 2017, 21:35
by man910
I was able to get around it by calling

Code: Select all

enum.name()
.

Re: [BUG] Switch not working with enum

Posted: 28 Nov 2017, 21:55
by Melloware
Yep that will turn the enum into a String. Good call.

Re: [BUG] Switch not working with enum

Posted: 06 Dec 2017, 20:50
by Melloware
You can use p:importEnum..

https://www.primefaces.org/showcase/ui/ ... Enum.xhtml

Or I reported it on GitHub and I have proposed a fix to compare both Object equality and String equality...

https://github.com/primefaces-extension ... issues/513