Note that there are some explanatory texts on larger screens.

plurals
  1. POGrouping radio button inside data grid using primefaces 3.3 and jsf 2.0
    text
    copied!<p>I am new to jsf 2.0 and therefore i am facing a serious issue grouping the prime faces datagrid and radio buttons. I am using JSF 2.0-Primefaces 3.3, java 1.6, and running my application on tomcat server on windows operating system. </p> <p>The issue is grouping data grid and radio button. The following paragraph will describe about an example code:</p> <pre><code> @ManagedBean(name="quickBill") @ViewScoped public class QuickBill extends BaseManagedBean implements Serializable { private List&lt;String[]&gt; insurerIDs=null; @PostConstruct public void init(){ loadInsurer(); } private void loadInsurer(){ logger.info("Entered Load Insurer"); insurerIDs = new ArrayList&lt;String[]&gt;(); if (null != insurerList) { insurerIDs.add(new String[] {"InsurerID1","Insurer_Name1") }); insurerIDs.add(new String[] {"InsurerID2","Insurer_Name2") }); insurerIDs.add(new String[] {"InsurerID3","Insurer_Name3") }); insurerIDs.add(new String[] {"InsurerID4","Insurer_Name4") }); } } public List&lt;String[]&gt; getinsurerIDs() { return insurerIDs; } } </code></pre> <p>The jsf code is as follows:</p> <pre><code> &lt;p:dataGrid var="quickBillVar" value="#{quickBill.insurerIDs}" columns="4" &gt; &lt;p:column selectionMode="single"&gt; &lt;p:selectOneRadio id="options" value="#{quickBill.selectedOption}"&gt; &lt;f:selectItem itemLabel="#{quickBillVar[1]}" itemValue="#{quickBillVar[1]}"/&gt; &lt;/p:selectOneRadio&gt; &lt;p:commandLink id="insurerid" title="Isurer"&gt; &lt;p:graphicImage value="../../images/insurers1/#{quickBillVar[0]}.jpg"/&gt; &lt;/p:commandLink&gt; &lt;/p:column&gt; &lt;/p:dataGrid&gt; </code></pre> <p>The above code when executed results in the display of the radio button, which allows user to select multiple radio button at the same time. However the requirement is to restrict user to select only one button rather than allowing user to select multiple button at a time. I have also used selectionMode="single" to produce the expected output but it didn't help much.</p> <p>Kindly help me on this or provide me with examples which will overcome this issue.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload