Page 1 of 1

selectonemenu - default value dissapear after selection

Posted: 24 Jul 2021, 03:16
by kimg
I'm running PF 10.0.0.

I have a selectonemenu defined like this:

Code: Select all

<p:selectOneMenu id="chair" value="#{setupSystemController.conference.conferenceChair}" style="margin-bottom:10px;"    >
                                    <f:converter converterId="staffConverter"/>
                                    <p:ajax event="valueChange" update="chairEmail"/>
                                    <f:selectItem itemLabel="Select Conference chair" itemValue=""   />
                                    <f:selectItems value="#{setupSystemController.staff}" var="staff" 
                                                   itemLabel="#{staff.firstName} #{staff.lastName}" itemValue="#{staff}"  />
                                </p:selectOneMenu>
when a user selects an option different from the default the default option is not available anymore so the user cant reset the chosen value.

I have tried to copy the basic selectonemenu from PF demo:

Code: Select all

<p:selectOneMenu id="option" value="#{selectOneMenuView.selectedOption}">
                    <f:selectItem itemLabel="Select One" itemValue=""/>
                    <f:selectItem itemLabel="Option1" itemValue="Option1"/>
                    <f:selectItem itemLabel="Option2" itemValue="Option2"/>
                    <f:selectItem itemLabel="Option3" itemValue="Option3"/>
                    <f:facet name="footer">
                        <p:divider styleClass="p-mt-0" />
                        <h:outputText value="3 options" style="font-weight:bold;"/>
                    </f:facet>
                </p:selectOneMenu>


and the same happens in my code - the default 'Select One' disappear but it works as expected in the demo.

I'm running Serenity 3.0.1 and when I run the live demo

https://www.primefaces.org/serenity/input.xhtml

it does exactly the same - default value is removed when a drop down value is selected.

Is that intentionally in Serenity?

Kim

Re: selectonemenu - default value dissapear after selection

Posted: 24 Jul 2021, 20:55
by siris
Hi,

Normally we would do this behavior only for the case with float label, but as a result of a bug it happened in both cases.

Please do this change on src/main/webapp/resources/sass/theme/extensions/_float_label.scss file at lines 30-40.

Code: Select all

.ui-float-label {
    .ui-selectonemenu-panel {
        &.ui-input-overlay {
            .ui-selectonemenu-items-wrapper {
                .ui-selectonemenu-items {
                    li:first-child {
                        display: none;
                    }
                }
            }
        }
    }
}
After than please run sass compile command:

Code: Select all

sass --update src/main/webapp/resources:src/main/webapp/resources --no-source-map
If the sass command run without any errors, you can use the new theme.css file. If you see an error, don't hesitate to ask for help!
Apart from that, we will add the same fix in the new version.

Best Regards,

Re: selectonemenu - default value dissapear after selection

Posted: 26 Jul 2021, 09:48
by siris
Hi,

New version released. Please ignore upper post and download and use new version. Sorry for upper buggy fix.

Best Regards,

Re: selectonemenu - default value dissapear after selection

Posted: 26 Jul 2021, 15:51
by kimg
Thank you for super fast reply and action.

kim

Re: selectonemenu - default value dissapear after selection

Posted: 27 Jul 2021, 06:44
by siris
You are welcome!

Best Regards,