You need to sign in to do that
Don't have an account?

JavaScript and PageBlockTable Column
Hi,
I am trying to pass a value from Visualforce page to Controller, by clicking on image with <apex:commandlink /> from PageBlockTable Column. Though I found some solutions where if I don't use PageBlockTable then it works so great. But I have to use PageBlockTable as per my requirement.
Here is a code for my Visualforce page:
<apex:outputPanel id="resultPanel" >
<apex:outputText ><b> {!SelectedValue} </b></apex:outputText>
</apex:outputPanel>
<apex:pageBlock id="Skulls"> <apex:pageblocksection id="pbsSkulls" rendered="true"> <apex:pageBlockTable id="pbtSkulls" value="{!lstSBones}" var="SB"> <apex:column > <apex:commandlink onclick="callActionMethod('{!SB.Skulls__c}');" > <apex:image url="{!$Resource.Plus}" height="20" width="20"/> </apex:commandLink> </apex:column> </apex:pageBlockTable> </apex:pageblocksection> </apex:pageBlock> <apex:actionFunction name="readCell" action="{!readCellMethod}" reRender="resultPanel" > <apex:param name="SkillNExpertise" assignTo="{!clickedCellValue}" value="" /> </apex:actionFunction> <script type="text/javascript"> function callActionMethod(txtSkull) { readCell(txtSkull); } </script>
And here is my controller where I am trying to receive value.
public String clickedCellValue { get; set; } public String SelectedValue { get; set; } public void readCellMethod() { SelectedValue = 'Selected Value: ' + ClickedCellValue; }
Any input would be really appreciated.
Thanks,
Sawan
Hi,
Have you tried the action support? This works for me :
All Answers
Hi,
Have you tried the action support? This works for me :
Hi Angad,
Your solution works so great for me. I spend 3 days and your answer helped me to make it work in 3 minutes. Once again, thank you so much for your effort and help.
-Sawan