+ Start a Discussion
Carter85Carter85 

Need help capturing a value from a single row in a table with a wrapper class.

I'm trying to pull a single value from a row in a table contained within a wrapper class so I can just execute a method based on that user selected item but I'm having an issue.  My VF markup for the table is as follows:
<apex:pageBlockTable value="{!pendList}" style="border:1px solid black;" var="p" rendered="{!NOT(ISNULL(pendList))}">
          		<apex:column style="border:1px solid black; text-align:center;  font-weight:bold; color:blue;" value="{!p.pIssue.Name}" headerValue="Claim Number"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px"  value="{!p.pIssue.MAG_Claim__r.Contract_Holder__r.Policy_Type__c}" headerValue="Policy Type"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px"  value="{!p.pIssue.CreatedDate}" headerValue="Date Opened"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px"  value="{!p.pIssue.RecordType.Name}" headerValue="Claim Type"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px"  value="{!p.pIssue.Damage_Type__c}" headerValue="Type of Loss"/>
          		<apex:column style="border:1px solid black; text-align:center; width:105px;  font-weight:bold; color:blue;" value="{!p.pIssue.Component_Status__c}" id="note" headerValue="Status"/>
          		<apex:column headerValue="Check/Add Attachments" style="border:1px solid black; text-align:center;" width="50px">
          			<apex:param assignTo="{!issID}" value="{!p.pIssue.ID}"/>
          			<apex:commandLink style="align:center" action="{!checkAttach}" rendered="{!p.pIssue.Component_Status__c == 'Pending'}">Check/Add</apex:commandLink>
          		</apex:column>
          	</apex:pageBlockTable>
And the method checkAttach(), which I'm trying to utilize on whichever row the user clicks the command link on looks like this so far:
public pageReference checkAttach(){
		    system.debug(issID);
		    fileList = [SELECT Name, ContentType, Description FROM Attachment WHERE Parent.ID =: issID];
    		if((!fileList.isEmpty())){
            	FOUND = true;
                this.message = null;
                return page.CM_WebClaimFileCheck;
                }
    		else{
            	this.message = 'No files attached.';
                return page.CM_WebClaimFileCheck;
                }	
              	return null;
    			}
I was hoping the <apex:param assignTo="{!issID}" value="{!p.pIssue.ID}"/> would take care of assiging that particular table item's ID to the ID variable I created, but it doesn't seem to assign the value as my debug statement claims it remains null.

Any help would be appreciated.

 
Best Answer chosen by Carter85
Balaji BondarBalaji Bondar
Hi, Use below code to pass selected rowId to backend:
<apex:commandButton value="Save New Expense" action="{!save}" rerender="pb" >
<apex:param name="SelectedId" value="{!Expense__c.Id}"/>
</apex:commandButton>
get the value in the apex like:
Id selId = Apexpages.currentPage().getParameters().get('SelectedId');

All Answers

Balaji BondarBalaji Bondar
Hi, Use below code to pass selected rowId to backend:
<apex:commandButton value="Save New Expense" action="{!save}" rerender="pb" >
<apex:param name="SelectedId" value="{!Expense__c.Id}"/>
</apex:commandButton>
get the value in the apex like:
Id selId = Apexpages.currentPage().getParameters().get('SelectedId');
This was selected as the best answer
Carter85Carter85
Yes, that fixed it.  Thanks.