You need to sign in to do that
Don't have an account?
Marc C.
Calling Actions with Parameters from a pageBlockTable
I've just read about a dozen posts on this issue but none of the solutions work for me. Parameters simply are not passed when the commandButton or commandLink is inside a pageBlockTable. The exact same commandLink code works outside the table (see below).
<apex:form >
<apex:pageBlock >
<apex:commandlink value="Connect(123)" action="{!selected}"> <apex:param name="customer" value="123"/> </apex:commandlink>
<apex:pageBlockTable value="{!matches}" var="i" id="theTable" styleClass="tableClass">
<apex:column >
<apex:commandlink value="Connect(333)" action="{!selected}">
<apex:param name="customer" value="333"/>
</apex:commandlink>
...
If you click the top link, the selected action is fired with the customer parameter set to 123.
If you click the link inside the column of the pageBlockTable no action is fired.
Here the relevant controller action snippet:
This action is not getting fired.
Don't know if this is relevant but my page has an auto action:
Use the assignTo parameter on the apex:param component to pass the value back into your controller so you can refer to it. The check you're doing on currentPage() just gives you the query parameters of the current page you're looking at.
"assignTo" and "string customer = ApexPages.currentPage().getParameters().get('customer');" are equivalent in that the value is passed from the page to the controller. Neither works because the real problem is the action not being called.
As I mentioned, the commandLink works outside of the pageBlockTable and I get the parameter with getParameters. The issue is not so much the parameter but the entire action "selected" is not invoked. Indeed, the debug console reveals that none of my actions are invoked when command link is clicked. When I log in as a normal user (I'm admin) the action would fire however (mostly). It feels like a bug in the framework...
Oh, sorry I misunderstood the issue. I tried your example and it did work as you expected it to.
The debug log printed out selected() and then 333 for me.
Maybe you have some validation failures on your page that are preventing your action from firing? Do you have any inputs in your table (perhaps required inputs) that could be invalid? Do you have a pageMessages component somewhere on your page?