jsf 2 - Identify when the selected row in the table is already selected -
i have p:datatable
in primefaces , have different listeners differents ways select row event in datatable.
i need identify when selected row in table selected, how can that?
i need because dont wonna p:blockui
runs when select row in table selected.
there page code:
... <pe:blockui autoshow="true" source="itemsdt" event="rowselect" target=":processtab"> <au:loading /> </pe:blockui> <p:datatable widgetvar="processestable" id="itemsdt" var="item" value=" {tasksbacking2.availableprocesses}" selection="#{tasksbacking2.selectedprocess}" rowkey="#{item.id}" tablestyleclass="table table-condensed table-bordered" resizablecolumns="true"> <p:ajax event="rowselect" listener="#{tasksbacking2.onclickfilldetails}" update="@this,:processtab,:menuform:menubar" /> ... </p:datatable> ...
on managed bean have listener:
... public void onclickfilldetails(selectevent event) { anoprocess clickedprocess = (anoprocess) event.getobject(); setselectedprocess(clickedprocess); motion currentmovement = this.getprocesseslastmovement().get(clickedprocess); if (currentmovement != null && !currentmovement.isviewed()) { markasread(processes); } ... }
here script check duplicate click on same row. set script below p:datatable
code.
<script type="text/javascript"> var prevrow ; function checkduprowclick(){ var currrow = $('tr.ui-widget-content.ui-datatable-selectable[aria-selected="true"]'); if($(currrow).is($(prevrow))){ //selected or clicked same row homecoming false prevent p:ajax executing homecoming false; }else{ //selected or clicked different row homecoming true allow p:ajax execute prevrow = currrow; homecoming true; } } </script>
and utilize function homecoming parameter p:ajax
<p:ajax event="rowselect" onstart="return checkduprowclick();" />
post comment if require more explanation.
jsf-2 primefaces primefaces-extensions
No comments:
Post a Comment