Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bug when displaying selectonemenu primefaces inside p panelgrid

I have this problem : enter image description here

here is the code :

    <p:panelGrid styleClass="newArticlePanelGrid" >

<!-- __________________________________________row1________________________________________________ -->
<p:row>

<p:column>
<h:outputLabel value="Designation : " />                        
</p:column>
<p:column colspan="3" >
<p:inputText id="new-article-designation"  style="width: 449px;"
                            value="#{articlesMB.article.designation}" required="true"
                            requiredMessage="designation requise" />

</p:column>

</p:row>

<p:row>

<p:column />
<p:column colspan="3" >
<p:message id="for-new-article-designation"
                            for="new-article-designation" display="text" />
</p:column>


</p:row>
<!-- __________________________________________row2________________________________________________ -->
<p:row>

<p:column>
<h:outputLabel value="Type : " />

</p:column>
<p:column>
    <p:selectOneMenu id="new-article-typeggg" required="true"
                            requiredMessage="type requis" converter="#{typeConverter}"
                            style="width:100%" value="#{articlesMB.article.type}">
                            <!--        <f:selectItem itemLabel="Selectionner Type" itemValue="" />-->
                            <f:selectItems value="#{articlesMB.listTypes}" var="v"
                                itemLabel="#{v.libelle}" itemValue="#{v}" />
                        </p:selectOneMenu>

</p:column>
<p:column>
    <h:outputLabel value="Unité : " />

</p:column>
<p:column>
    <p:selectOneMenu id="new-article-unite" required="true"
                            widgetVar="uniteselect" requiredMessage="unité requise"
                            converter="#{uniteConverter}" style="width:100%"
                            value="#{articlesMB.article.unite}">
                            <!--            <f:selectItem itemLabel="Selectionner Unite" itemValue=""  /> -->
                            <f:selectItems value="#{articlesMB.listUnites}" var="v"
                                itemLabel="#{v.libelle}" itemValue="#{v}" />
                        </p:selectOneMenu>

</p:column>

</p:row>

<p:row>

<p:column />
<p:column>

I don't know what I should do to reolve this problem : I tested width:100% but as you see it doesn't change

how can I resolve that ?

thank you in advance

like image 298
begiPass Avatar asked May 12 '13 14:05

begiPass


1 Answers

The problem come from style="100%", it only change selectonemenu's width, you should set width for label inside selectonemenu(in this situation):

            <style type="text/css">
                .ui-selectonemenu-label{
                    width:100% !important;
                }
            </style>

If you want set all selectonemenu:

             <style type="text/css">
                .ui-selectonemenu-label{
                    width:100% !important;
                }
                .ui-selectonemenu{
                    width:100% !important;
                }
            </style>

for more general, you can include in css file.

See also: What is the JSF resource library for and how should it be used?

like image 178
Rong Nguyen Avatar answered Oct 11 '22 04:10

Rong Nguyen