I am having a hard time to figure out how I can include the radio button select option within the PageBlockTable. I am searching all the cases related to a contact here.
Logic in my controller extension which gets all the cases where contact name match:
public List<Case> excase{get;set;}
public List<SelectOption> casesradio{get;set;}
public String radioValue{get;set;}
public Pagereference search() {
excase = [Select Id, CaseNumber, Status, Subject from Case where contact.Name = : first + ' ' + last];
for (Case cd: excase) {
casesradio.add(new SelectOption(cd.Id, cd.Subject));
}
return null;
}
I use PageblockTable tag to show it on the Page:
<apex:pageblockTable value="{!excase}" var="exscase" id="caselist">
<apex:column value="{!exscase.CaseNumber}"/>
<apex:column value="{!exscase.Status}"/>
<apex:column value="{!exscase.Subject}"/>
</apex:pageblockTable>
I would also like user to select a particular case and update it.(My update has some logic which is irrelevant for this question). I use below code to show the cases as radio button selectOption:
<apex:selectRadio label="Select Case to Update" value="{!radioValue}">
<apex:selectOptions value="{!casesradio}"/>
</apex:selectRadio>
This appears in a single line as shown in screenshot. My logic in extension for select option is(same as above):
public List<Case> excase{get;set;}
public List<SelectOption> casesradio{get;set;}
public String radioValue{get;set;}
public Pagereference search() {
excase = [Select Id, CaseNumber, Status, Subject from Case where contact.Name = : first + ' ' + last];
for (Case cd: excase) {
casesradio.add(new SelectOption(cd.Id, cd.Subject));
}
return null;
}
I am trying to get the radio button for each row in PagebLockTable as show in the screen shot. I would like to select the radio button and pass the selected case back to my extension when I click update. How can the code be modified to accomplish this.
cContact
in the linked example) instead of a list ofCase
. Each one of those wrappers will have aCase
record "inside" it (con
in the linked example).