填充表时如何防止ajax按钮触发

时间:2014-04-07 07:48:40

标签: ajax jsf primefaces

如何阻止在我填充的数据表中的每一行调用ajax事件。我只想在单击按钮时发生呼叫。

这是使用primefaces。

<p:column id="save">
                    <f:facet name="header">Spara</f:facet>
                    <!-- p:commandButton value="Visa lista" action="#{serviceScoreDB.saveScores(player, serviceHCP.myCurrentClub, 
                    serviceSerieType.mySerieType, aScore.playDate, aScore.totalScore, aScore.serieNo)}"  -->
                    <p:commandButton value="Visa lista">
                        <p:ajax listener="#{serviceScoreDB.saveScores(player, serviceHCP.myCurrentClub, 
                    serviceSerieType.mySerieType, aScore.playDate, aScore.totalScore, aScore.serieNo)}" />

                    </p:commandButton>      
                </p:column> 

1 个答案:

答案 0 :(得分:1)

尝试将以下代码放在commandButton组件中:

<p:commandButton value="Visa lista">
   <p:ajax event="click" process="@this" partialSubmit="true"  
      listener="#{serviceScoreDB.saveScores(player, serviceHCP.myCurrentClub, serviceSerieType.mySerieType, aScore.playDate, aScore.totalScore, aScore.serieNo)}" />
</p:commandButton>