I want to call a listener using ajax event rowSelectCheckBox on Lazy Data Model
with selected multiple
. I create a methode in my backing bean, but this method is not called.
Can anyone help to solve this?
my xhtml:
<h:form id="frmDataTableMutasi">
<p:outputLabel value="Daftar Toko Akan Dimutasi"
styleClass="outputlabel-title" />
<br />
<p:dataTable widgetVar="widgetDataModel" var="dataModel"
id="dataTable" value="#{tokoListBean.lfaStoreDataModel}" lazy="true"
paginator="true" rows="5" paginatorPosition="bottom"
emptyMessage="No record found"
selection="#{tokoListBean.selectedLfaStore}"
selectionMode="multiple"
currentPageReportTemplate="{currentPage}/{totalPages}"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15">
<p:ajax event="rowSelectCheckbox"
listener="#{tokoListBean.onRowSelect}" update=":frmBtn:btnMutasi" />
<p:ajax event="rowUnselectCheckbox"
listener="#{tokoListBean.onRowUnselect}" update=":frmBtn:btnMutasi" />
<p:column selectionMode="multiple"
style="width:16px;text-align:center" />
<p:column>
<h:outputText value="#{dataModel.storeCode}" />
</p:column>
<p:column>
<h:outputText value="#{dataModel.storeName}" />
</p:column>
<p:column>
<h:outputText value="#{dataModel.snStoreType}" />
</p:column>
</p:dataTable>
my backing bean:
public void onRowSelect(SelectEvent event) {
System.out.println("onRowSelect");
this.enableBtnMutasi = false;
}
public void onRowUnselect(UnselectEvent event) {
System.out.println("onRowUnselect");
this.enableBtnMutasi = true;
}
try delete widgetVar="widgetDataModel"
and add following code:
<p:ajax event="toggleSelect" listener="#{tokoListBean.onRowToggle()}" update=":frmBtn:btnMutasi"/>
<p:ajax event="rowSelectCheckbox" listener="#{tokoListBean.onRowSelect}" update=":frmBtn:btnMutasi"/>
<p:ajax event="rowUnselectCheckbox" listener="#{tokoListBean.onRowUnselect}" update=":frmBtn:btnMutasi"/>
<p:ajax event="rowSelect" listener="#{tokoListBean.onRowSelect}" update=":frmBtn:btnMutasi"/>
<p:ajax event="rowUnselect" listener="#{tokoListBean.onRowUnselect}" update=":frmBtn:btnMutasi"/>