jsf 2 - How I conditionally stop execution <p:dataTable>'s page event during page change -


in application have <p:datatable> pagination using lazy datamodel.

i have requirement when click page button page, confirmation popup should generate, if click yes can go page , if click 'no' can't go page , stay in current page.

.xhtml code given below:

<h:form id="userlistform">     <p:datatable var="user" id="usertable" value="#{userlistcontroller.userdatamodel}" lazy="true" paginator="true" rows="25" paginatorposition="bottom"             paginatortemplate="{currentpagereport}  {firstpagelink} {previouspagelink} {pagelinks} {nextpagelink} {lastpagelink} {rowsperpagedropdown}"             rowsperpagetemplate="25,50,100" widgetvar="userdatatable" styleclass="usertable" selectionmode="single" >        <p:ajax event="page" />         <p:column id="namecolumn" headertext="#{adbbundle['name']}"            sortby="#{user.fullname}" filterby="#{user.fullname}" styleclass="username">            <h:outputtext value="#{user.fullname}" />        </p:column>         <!-- other columns -->      <:/p:datatable> </h:form> 

i using primefaces 3.4, jsf 2.0.

inspired rongnk's answers, may this,

add script block :

<script type="text/javascript">     function onpagestart() {         return confirm('are sure?');     } </script> 

and put in datatable :

<p:ajax event="page" onstart="return onpagestart()" /> 

you inline in <p:ajax way :

<p:ajax event="page" onstart="return confirm('are sure?');" /> 

tested , working primefaces 3.4.2


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -