selectonemenu - default value dissapear after selection

Post Reply
kimg
Posts: 53
Joined: 22 Aug 2013, 17:13

24 Jul 2021, 03:16

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
Primefaces 6.2 / Glassfish 5 / Payara 5.182

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

24 Jul 2021, 20:55

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,

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

26 Jul 2021, 09:48

Hi,

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

Best Regards,

kimg
Posts: 53
Joined: 22 Aug 2013, 17:13

26 Jul 2021, 15:51

Thank you for super fast reply and action.

kim
Primefaces 6.2 / Glassfish 5 / Payara 5.182

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

27 Jul 2021, 06:44

You are welcome!

Best Regards,

Post Reply

Return to “Serenity - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests