• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Single radio button group for all rows in the rich:dataTable

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a rich:dataTable listing data rows with a radio button for each row, but these radio buttons should belong to a single radio button group so only one row can be selected from these radio buttons. However, when I use the following code, the radio button for each row belongs to its own radio button group, please help figure out some approach to have all rows' radio buttons belong to a single radio button group. Thanks.

<rich:dataTable id="linesId" var="line" value="#{dataTableAction.lines}"
rowClasses="rowLight, rowDark" headerClass="tableHeader" styleClass="table" columnClasses="tableColumn"
cellpadding="0" cellspacing="0" border="0" width="100%">
<h:column>
<f:facet name="header">
<h:outputText value="Select" />
</f:facet>
<h:selectOneRadio id="lineRadio" layout="lineDirection">
<f:selectItem itemValue="#{line.selected}" itemLabel="">
</f:selectItem>
</h:selectOneRadio>
</h:column>
<h:column>
<f:facet name="header">
Name
</f:facet>
<h:outputText value="#{line.name}" size="25" rendered="#{line.existing}" styleClass="tableOutput"/>
</h:column>
</rich:dataTable>
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's just how JSF works, every row is its own group.
You can use JavaScript, first go over all the radio buttons and uncheck them and then check the newly selected.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi.. did you get a solution for this? even i am facing a similar problem.. kindly post the solution if you have solved it..
 
reply
    Bookmark Topic Watch Topic
  • New Topic