+ Start a Discussion
WilmerWilmer 

How to display a SelectRadio into a pageBlockTable?

Hi,

 

All I want is to enable an unique selection from one row, like this:

 

 

 Select one      Type           Class       Full Address 

       o               Option 1     class 1       Apple street 19 88
       o               Option 2     class 2       Orange avenue 30 56 

 

 

I have a pageBlockTable and want that one of the columns be a selectRadio button according to the record I display in the row.

 

 

<apex:pageBlockTable value="{!Direcciones}" var="Direccion" id="theTable" width="100%">
<apex:column id="col0">
<apex:facet name="header">Select one</apex:facet>
<apex:selectRadio id="selectDir" value="{!MiDireccion}" layout="pageDirection">
<apex:selectOption itemValue="{!Direccion.id}" itemLabel="{!Direccion.Name}">

</apex:selectOption>

</apex:selectRadio>
</apex:column>
<apex:column id="col1">
<apex:facet name="header">Type</apex:facet>
<apex:outputText value="{!Direccion.Tipo__c}"/>
</apex:column>
<apex:column id="col2">
<apex:facet name="header">Class</apex:facet>
<apex:outputText value="{!Direccion.Clase_Direccion__c}"/>
</apex:column>
<apex:column id="col3">
<apex:facet name="header">Full Address</apex:facet>
<apex:outputText value="{!Direccion.Direccion_Completa__c}"/>
</apex:column>
</apex:pageBlockTable>

 

The problem is that for every row it is set a new selectRadio object and for that reason the selection is not unique. I tried to make the next workaround but didn´t work because of a sintax error.

 

 

<apex:selectRadio id="selectDir" value="{!MiDireccion}" layout="pageDirection">
<apex:column id="col0">
<apex:facet name="header">Select one</apex:facet>
<apex:selectOption itemValue="{!Direccion.id}" itemLabel="{!Direccion.Name}"></apex:selectOption>
</apex:column>
</apex:selectRadio>

 

 

Please help with this issue.

 

 Thanks,

 

Wilmer

 

Message Edited by Wilmer on 05-22-2009 01:12 PM
mtbclimbermtbclimber

You're not going to be able to get the behavior you want with standard components.  You're going to have to drop to raw html and use some javascript to sync the value to an apex:inputHidden component bound to the property/field you are after.

 

If you'd like to see a standard component for this in the future please log an idea on the idea exchange (see tab above).

 

Regards,

WilmerWilmer

Hi, Andrew.

 

Thanks for your answer.

 

Look, there is already a posted idea about this topic (please, anyone who sees this log, go and vote):

 

 Support dependent picklist in Visualforce

 

http://ideas.salesforce.com/article/show/10092833/Support_Dependent_Picklists_in_Visualforce

 

Regards,

 

 

Wilmer

mtbclimbermtbclimber
Sure but did you post the wrong idea or did you respond to the wrong thread? :smileysurprised: