I have a dataTable with different rows, when i select the particular rows i don't want to perform any onClick event on the particular row. I want to prevent calling show() method in oncomplete. I have tried different ways but, i am unable to stop it.
Here is my code given below.
<h:form id="availableBooksForm">
<p:messages />
<p:panel>
<p:remoteCommand name="show" action="#{boAction.selectPromotion}" />
<p:dataTable id="BooksTable" value="#{userProfile.availableBooks}"
var="res" selectionMode="single" rowKey="#{res.promotionId}"
rows="#{referenceData.recordsPerPage}" lazy="true"
resizableColumns="true" paginator="true"
paginatorTemplate="#{referenceData.paginatorTemplate}"
paginatorPosition="bottom" paginatorAlwaysVisible="false"
style="margin-top: 5px; text-overflow: ellipsis;">
<p:ajax event="rowSelect" listener="#{boAction.onSelectPromotion}"
oncomplete="show()" />
<p:column headerText="#{msg.promotionInfo}">
<p:panelGrid columns="2" columnClasses="pct50,"
style="font-size: 12px">
<h:outputText value="#{msg.promoCode}" />
<h:outputText value="#{res.promoCode}">
<f:convertNumber pattern="#{userProfile.displayStringFormat}" />
</h:outputText>
<h:outputText value="#{msg.promoName}" />
<h:outputText value="#{res.promoName}">
<f:convertNumber pattern="#{userProfile.displayStringFormat}" />
</h:outputText>
</p:panelGrid>
</p:column>
</p:dataTable>
</p:panel>
here i am calling the onSelectPromotion method to return nothing as shown in the below:
public void onSelectPromotion(SelectEvent event) {
String selectedType = ((AllBooks) event.getObject()).getPromoType();
if(selectedType.equals(BookType.getBookType)) {
return;
}
}
after this the show() method is calling the boAction.selectPromotion action. I dont want to call this method. How can i prevent this by selecting particular row from the dataTable.
I don't want to execute this method if i select the row from the table.
public String selectPromotion() {
//some code is executing here
}