Page 1 of 1

p:commandLink is calling row selection with selectRow=false

Posted: 30 Jan 2018, 15:26
by LarsD
Dear support team,

I've got the following component structure:

Code: Select all

<p:dataTable ... >
		<p:ajax
			event="rowSelect"
			listener="#{....}">
		</p:ajax>
		<p:columns
			...
			selectRow="true/false depending on column content">
				..Content of columns..
		</p:columns>
</p:dataTable>
In general the row selection and the disabling of selecting a row in spezified columns works as expected.

In the first column I've got this content:

Code: Select all

			<h:form ... >
				<p:commandLink
					....
					immediate="true"
					update="...">
					<h:panelGroup >
						<span
							id="cb_searchResultSelected"
							class="fa ..." />
					</h:panelGroup>
				</p:commandLink>
			</h:form>
If I click somewhere in the cell in the first column everything is ok, nothing happend because of disabled row selection for this column. If I hit the Icon (span node) which means clicking the commandLink the command action is called first and the event is being forwarded to datatable row selection as well. So the selection is done as well - and this is not as expected!

Is there a way to prevent p:commandLink form passing the click to the dataTable row or is it just a bug in implementation of disabling the row selection in the p:columns component?

Thanks in advance.

It is PrimeFaces 6.1 with CDI on a JBoss EAP.

Lars

Re: p:commandLink is calling row selection with selectRow=false

Posted: 09 Feb 2018, 10:21
by LarsD
Hello.
Does no one has any hint how to fix this?

I did not found a work around so far.

Lars

Re: p:commandLink is calling row selection with selectRow=false

Posted: 10 Feb 2018, 16:01
by kukeltje
I'm pretty sure I suggested something in your stackoverflow question.

Re: p:commandLink is calling row selection with selectRow=false

Posted: 13 Feb 2018, 14:33
by LarsD
Which question?
I did not post anything on stackoverflow.

kind regards

Re: p:commandLink is calling row selection with selectRow=false

Posted: 13 Feb 2018, 22:18
by kukeltje
Sorry, correct. I almost responded to https://stackoverflow.com/questions/248 ... click?rq=1 but in the end did not. What you could try is add an onClick on the button and in that prevent the event from bubbling up. There are multiple ways and these workarounds are a generic javascript/jquery thing, nothing jsf/primefaces related.

Also track this closely related issue: https://github.com/primefaces/primefaces/issues/3310