我在RichFaces中使用JSF2。在我的表单上,我有dataTable与dataScroller和commandButton与ajax。问题是每当我点击dataScroller转到ajax激活的下一页时。这是错的。我只想在点击“提交”按钮时激活ajax。
<h:form id="approveForm">
<h:panelGrid>
<rich:dataTable width="100%" value="#{customBean.approvalList}"
var="item" id="table" rowClasses="odd-row, even-row"
rows="5" styleClass="my-custom-table">
<f:facet name="header">
<h:outputText value="WorkItems List" />
</f:facet>
<rich:column>
<f:facet name="header">Comments</f:facet>
<h:inputText name="comment" />
</rich:column>
</rich:dataTable>
<rich:dataScroller for="table" maxPages="5"
fastStep="3"styleClass="pagination-right"/>
</h:panelGrid>
<h:panelGrid>
<h:commandButton value="Submit" action="#{customBean.submit_complete}"
class="btn primaryBtn btn btn-success btn-next"
onclick="function_submit();">
<a4j:ajax execute="@form" render="pnlResult"
onevent="handleDisableButton" />
</h:commandButton>
<a4j:status>
<f:facet name="start">
<h:outputText id="test" value="In Progress...." />
<h:graphicImage value="../../images/progress.gif" alt="Working" />
</f:facet>
<f:facet name="stop">
</f:facet>
</a4j:status>
<h:outputText id="pnlResult" value="#{customBean.result}" escape="false" />
</h:panelGrid>
</h:form>