I am looking for code snippet which renders radio button group in datatable.
I have the following snippet which has the following problems
1) it displays -1 next to radio button as its the value assign to
selectedRowId in backing bean
2) the radio button selection doesnt clear off . i.e. i can select multiple
radio buttons at the same time
3) when i select first radion button it correctly displays the index as 0
but for subsequent radio buttons it doesnt show correct index value
Here is the snippet
<a4j:outputPanel >
<h:dataTable id="deviceDetailTable" styleClass="list"
rowClasses="odd,even"
value="#{deviceDetailBean.tableRow}"
var="vartableRow"
width="80%">
<h:column id="column1">
<h:selectOneRadio id="radio1" value="#{deviceDetailBean.id}">
<a4j:support event="onclick" reRender="selectors" />
<f:selectItem itemValue="#{deviceDetailBean.selectedRowId}" />
</h:selectOneRadio>
</h:column>
<h:column>
<f:facet name="header"><h:outputText
value="MAC"/></f:facet>
<h:outputText id="mac" value="#{vartableRow.mac}" />
</h:column>
<h:column>
<f:facet name="header"><h:outputText
value="Namespace"/></f:facet>
<h:outputText id="mac"
value="#{vartableRow.namespace}" />
</h:column>
<h:column>
<f:facet name="header"><h:outputText value="IP
Address"/></f:facet>
<h:outputText id="mac"
value="#{vartableRow.ipAddress}" />
</h:column>
<h:column>
<f:facet name="header"><h:outputText value="Host
Name"/></f:facet>
<h:outputText id="mac"
value="#{vartableRow.hostName}" />
</h:column>
<h:column>
<f:facet name="header"><h:outputText value="Name
Type"/></f:facet>
<h:outputText id="mac"
value="#{vartableRow.nameType}" />
</h:column>
</h:dataTable>
</a4j:outputPanel>
Here is the snippet in Backing Bean
private Integer id;
private int selectedRowId = -1;
with setter/getter methods
Regards
Bansi
--
View this message in context:
http://www.nabble.com/Group-Radio-Buttons-in-DataTable-tf3653488.html#a10206582
Sent from the MyFaces - Users mailing list archive at Nabble.com.