Monday, 15 February 2010

jsf - Primefaces: Exclude column from row selection in p:dataTable -



jsf - Primefaces: Exclude column from row selection in p:dataTable -

i've got problem p:datatable , excluding column single row selection.

i have 4 columns in datatable. first 3 needed display fileid, filename , uploaddate. in 4th column there command button each row start action of file processing. there row selection (with ajax action on event) navigates file details page. now, when click on anywhere on row (including button) navigates me details page.

there's current code:

class="lang-html prettyprint-override"><h:form> <p:datatable id="billingfiles" value="#{billingfiles}" var="billingfile" rowkey="#{billingfile.billingfile.idbillingfile}" filteredvalue="#{billingservice.filteredbillingfiledatamodels}" selectionmode="single" paginator="true" rows="10"> <p:ajax event="rowselect" listener="#{billingservice.selectbillingfilerow}" /> <p:column sortby="#{billingfile.id}" filterby="#{billingfile.id}" id="idfile" headertext="#{msg['billing.file.id']}" filtermatchmode="contains"> <h:outputtext value="#{billingfile.id}" /> </p:column> <p:column sortby="#{billingfile.uploaddate}" filterby="#{billingfile.uploaddate}" id="uploaddate" headertext="#{msg['billing.file.upload_date']}" filtermatchmode="contains"> <h:outputtext value="#{billingfile.uploaddate}" /> </p:column> <p:column sortby="#{billingfile.filename}" filterby="#{billingfile.filename}" id="filename" headertext="#{msg['billing.file.file_name']}" filtermatchmode="contains"> <h:outputtext value="#{billingfile.filename}" /> </p:column> <p:column id="loadbillingfile"> <p:commandbutton id="loadbillingfilebutton" rendered="#{billingfile.filestatus.equals('uploaded')}" value="#{msg['billing.load_billing_file']}" action="#{billingservice.loadbillingfile(billingfile.billingfile)}" update=":form" /> </p:column> </p:datatable> </h:form>

and there method navigates file details page:

public void selectbillingfilerow(selectevent event) { billingfiledatamodel billingfiledatamodel = (billingfiledatamodel) event.getobject(); if (billingfiledatamodel != null) { selectedbillingfile = billingfiledao.findbillingfilebyid(billingfiledatamodel.getbillingfile().getidbillingfile()); facescontext.getcurrentinstance().getexternalcontext() .getrequestmap().put(jsfview.event_key, "viewbillingfile"); } }

is there way exclude column button row selection? need start processing file, without navigating me other page.

i found partial solution problem. prevented rowselect ajax action executing, when onclick event occurs.

i added line p:commandbutton:

onclick="event.stoppropagation();"

i said works partially, because click on column button, not on button itself, still executes rowselect action.

jsf primefaces datatable spring-webflow

No comments:

Post a Comment