Unnecessary double click on p:commandbuttonn

UI Components for JSF
Post Reply
facundo
Posts: 7
Joined: 10 Nov 2010, 20:34

02 Mar 2011, 23:57

I´m using PF2.2.M1 + JSF2 + jboss .

I have a method of SessioScoped bean called by the action attribute of a p:commandbutton . Nevertheless, the action is only called the second time i click the button.
here is the code : I´m not postig the complete page cause is long, only the datatable with rowselection that renders and displays the dialog with commandbutton in question (Inserir) The dialog is inside an outputpanel so becaus is the onçy way i could ajax rendered it. I tested by putting the exactly same panelgrid inside an ajax rendered p:panel in one of the layoutUnits, and the same thing happend , so it´s not the fact of being inside a dialog.
produtoBean is SessionScoped.

Code: Select all

<f:view>
  <h:body>     

            <p:layout fullPage="true" >
<p:layoutUnit id="left" position="left"   resizable="true"   width="400" minWidth="200" scrollable="true" >
                    <p:tabView>
                        <p:tab title="Produtos">
                            <h:form>
                                <p:dataTable var="produto" value="#{produtoBean.lista}"
                                             emptyMessage="Nenhum produto achado com essa descrição"
                                             selection="#{produtoBean.produto}" selectionMode="single"
                                             onRowSelectUpdate="produto" onRowSelectComplete="produtoDialog.show()"  >

                                    <p:column filterBy="#{produto.descricao}"
                                              headerText="Descricão"
                                              filterMatchMode="startsWith">
                                        <h:outputText value="#{produto.descricao}" />
                                    </p:column>

                                    <p:column headerText="Preço" style="width:70px;"  >
                                        <h:outputText value="#{produto.precoVenda}" converter="moneda"/>
                                    </p:column>
                                </p:dataTable>
                            </h:form>
                        </p:tab>
<p:tab> ...
</p:tab>
       </p:tabView>

</p:layoutUnit>
...(other layout units here)
</p:layout>
....



            <p:outputPanel id="produto" >
                <h:form prependId="false">
                    <p:dialog header="Produto escolhido" widgetVar="produtoDialog" resizable="false"
                              width="600" position="center" draggable="false" modal="true">
                        <h:panelGrid columns="5" cellpadding="10"  >
                            <h:outputLabel  value="#{produtoBean.produto.descricao}"  />
                            <h:outputLabel value="Preço :" style="font-weight: bold;"/>
                            <h:outputLabel value="#{produtoBean.produto.precoVenda}" converter="moneda"/>
                            <p:spinner id="qtde2" value="#{produtoBean.qtde}" min="1" max="100" style="width:40px;" />
                            <p:commandButton value="Inserir" action="#{produtoBean.adicionaItem}"  update="center" />
                        </h:panelGrid>
                    </p:dialog>
                </h:form>
            </p:outputPanel>
            
        </h:body>
    </f:view>
</html>


I would really apreciate your help.

Thank you!

callahan
Posts: 768
Joined: 27 May 2010, 22:52

03 Mar 2011, 00:23

If you're using 2.2.M1 then you're probably having the issue discussed here: http://code.google.com/p/primefaces/iss ... il?id=1231. This was fixed a long time ago, so you should update to 2.2.1 where the problem no longer exists.

facundo
Posts: 7
Joined: 10 Nov 2010, 20:34

03 Mar 2011, 15:23

Thank you for your answer Callahan. Indeed I changed the to PF 2.2.1 but as you can see in the code i posted in that form i had a spinner... now the spinner up and down buttons don´t show . Is there something i can do to for the spinner to be shown correctly?

Best regards,

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Mar 2011, 15:34

Spinner when placed inside an initially hidden component has this problem, we'll work on this soon.

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

03 Mar 2011, 15:43

There is a workaround for the spinner issue discussed here if you have to have it working immediately:

http://primefaces.prime.com.tr/forum/vi ... f=3&t=5051

facundo
Posts: 7
Joined: 10 Nov 2010, 20:34

03 Mar 2011, 22:07

thank you both. If it´s of any use to know , in version 2.2.M1 worked fine. Bumble.bee I tried to uso your onShow=.. suggestion but i couldn´t make it work fine. I decided to use just an inputText with the validation necessary.
Thank u for your support .
Keep up the good work!

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 38 guests