p:commandLink is calling row selection with selectRow=false

UI Components for JSF
Post Reply
LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

30 Jan 2018, 15:26

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

LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

09 Feb 2018, 10:21

Hello.
Does no one has any hint how to fix this?

I did not found a work around so far.

Lars

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

10 Feb 2018, 16:01

I'm pretty sure I suggested something in your stackoverflow question.

LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

13 Feb 2018, 14:33

Which question?
I did not post anything on stackoverflow.

kind regards

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

13 Feb 2018, 22:18

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

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests