I have a table with two actions, first is delete record If i click on delete icon (commandLink), the second action get record Info when I click on the row. but If I click on delete (Icon) the two actions executed (get Info & Delete the record). I tried to use immediate on commandLink but nothing happened.
VF Code
<apex:form id="InfoForm">
<apex:pageBlock title="Accounts Information">
<apex:pageBlockTable value="{!Accounts}" var="acc" id="InfoTable" >
<apex:column headerValue="#" >
<apex:commandLink reRender="InfoForm" action="{!delete}" >
<apex:image alt="Delete" value="{!$Resource.delete_icon}" />
<apex:param name="AccId" value="{!acc.id}" assignTo="{!accId}"/>
</apex:commandLink>
</apex:column>
<apex:column headerValue="Name" value="{!acc.Name}"/>
<apex:column headerValue="Phone" value="{!acc.Phone}"/>
<apex:actionSupport event="onRowClick" action="{!getAcc}" reRender="AccountForm">
<apex:param name="AccId" value="{!acc.id}" assignTo="{!accId}"/>
</apex:actionSupport>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
Attribution to: user3003810
Possible Suggestion/Solution #1
The cause of the problem is most likely the way events - such as click - are made available to the hierarchy of HTML elements. The way this is done varies between browsers - see articles such as Event order for detail - and adding the appropriate JavaScript to stop it in all browsers is a bit awkward and requires testing in multiple browsers. (See the link for how.)
This problem is avoided in standard Salesforce UI by having an "Actions" column containing all the links and not having any event handling on the overall table row. Using a design of that nature is the simplest fix.
Attribution to: Keith C
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33191