Grouping Radio Buttons in DataTable

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

Hello There,
I too am stuck up with the same problem. My HTML document contains two radio buttons which belong to the same group. But when displayed on a Jeditorpane the radio buttons does'nt behave as a part of a group. Both the radio buttons get selected. If you have come across a solution..please help me..
Thanx
Mohamed Zafer

Similar Messages

  • Getting the selected row (selected using radio button in dataTable)

    I have problem getting the selected row.
    If not mistaken, the way used in BalusC's website sets the value to the backing bean using the valueChangeListener.
    Can I set the value to the DTO instead?
    using something like
    private boolean selected;
    public void setSelectedItem(ValueChangeEvent e){
    this.selected = true;
    }  If i use this way it throws NoSuchMethodException. I have no idea why. I did this for the checkbox and it works fine. I don't know why it doesn't work for radio buttons.

    The DataTable is below :
    <h:panelGrid columns="1" columnClasses="table_align">
              <t:dataTable id="table1" value="#{sysMgrBean.locationList}"
                   var="location" rows="5" styleClass="table" headerClass="tableHeader"
                   rowClasses="tableRowOdd, tableRowEven" width="500">
                   <t:column>
                        <f:facet name="header">
                             <h:outputText styleClass="lbl" value="#{lbl['no']}" />
                        </f:facet>
                        <h:outputText value="#{location.id}" />
                   </t:column>
                   <t:column>
                        <f:facet name="header">
                             <h:outputText styleClass="lbl" value="#{lbl['slct']}" />
                        </f:facet>
                        <h:selectOneRadio  value="#{location.selected}"
                             onfocus="dataTableSelectOneRadio(this);"
                             onclick="enableInput(this.form,this)" valueChangeListener="#{location.setSelectedItem}">
                             <f:selectItem itemValue="" value="true" />
                        </h:selectOneRadio>
                   </t:column>
                   <t:column>
                        <f:facet name="header">
                             <h:outputText styleClass="lbl" value="#{lbl['cd']}" />
                        </f:facet>
                        <h:outputText value="#{location.loccd}" />
                   </t:column>
                   <t:column>
                        <f:facet name="header">
                             <h:outputText styleClass="lbl" value="#{lbl['desc']}" />
                        </f:facet>
                        <h:inputText id="Description" value="#{location.descr}" disabled="#{location.disabled}" />
                   </t:column>
              </t:dataTable>In the DTO :
    private boolean selected;
    public void setSelectedItem(ValueChangeEvent e){
    this.selected = true;
    }

  • Group radio button itemrenderers of two different lists

    Hello ,
    How do I group radio button item-renderers of two different lists? If i select a radio button of list 1, then the list 2  Radiobutton which was selected previously should be un-selected. How to do?

    Are you looking for something like this:
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark">
        <fx:Declarations>
            <fx:Component className="MyRenderer">
                <s:ItemRenderer>
                    <s:RadioButton id="rb" label="{data}" group="{outerDocument.rbg}" width="100%" height="100%" />
                </s:ItemRenderer>
            </fx:Component>
            <s:RadioButtonGroup id="rbg" />
        </fx:Declarations>
        <s:List id="myList" itemRenderer="MyRenderer">
            <s:dataProvider>
                <s:ArrayList>
                    <fx:String>0</fx:String>
                    <fx:String>1</fx:String>
                    <fx:String>2</fx:String>
                </s:ArrayList>
            </s:dataProvider>
        </s:List>
        <s:List id="myList2" x="150" itemRenderer="MyRenderer">
            <s:dataProvider>
                <s:ArrayList>
                    <fx:String>A</fx:String>
                    <fx:String>B</fx:String>
                    <fx:String>C</fx:String>
                </s:ArrayList>
            </s:dataProvider>
        </s:List>
    </s:Application>

  • How to Use Switch Statement with Exclusion Group (radio buttons)?

    Wouldn't you know, just when I though I'd really be making progress, I've come across another problem I can't solve. In a homeowners insurance application I am building, there is an exclusion group that needs to set the value of several variables
    I have setup in the form properties/variables. These variables take on different values depending on the users choice.  For the exclusion group, in the object pallet, I have set the binding to normal, and have checked the "Specify Item Values" check box. Also the values for the choices have been assigned 1,2,3,4,5.
    Here is my code for the change event fir the exclusion group (This is exactly what I have tried). For now, the values for the variables to take on in the different cases, are completely arbitrary.
    switch (this.change.rawValue)              // I have tried so many things here
        case "1":                                        // I have tried the caption, single quotes in all combinations
            addLivingExp = "1";
            damageOthersProperty = "2";
            liabilityIncl = "3";
            maxCoverage = "4";
            minCoverage = "5";
            persProperty = "6";
            relatedPrivateStruct = "7";
            break;
        case "2":    
            addLivingExp = "10";
            damageOthersProperty = "20";
            liabilityIncl = "30";
            maxCoverage = "40";
            minCoverage = "50";
            persProperty = "60"
            relatedPrivateStruct = "70";
            break;
        case "3":    
            addLivingExp = "100";
            damageOthersProperty = "200";
            liabilityIncl = "300";
            maxCoverage = "400";
            minCoverage = "500";
            persProperty = "600"
            relatedPrivateStruct = "700";
            break;
        case "4":    
            addLivingExp = "1000";
            damageOthersProperty = "2000";
            liabilityIncl = "3000";
            maxCoverage = "4000";
            minCoverage = "5000";
            persProperty = "6000"
            relatedPrivateStruct = "7000";
            break;   
        case "5":    
            addLivingExp = "10000";
            damageOthersProperty = "20000";
            liabilityIncl = "30000";
            maxCoverage = "40000";
            minCoverage = "50000";
            persProperty = "60000"
            relatedPrivateStruct = "70000";
            break;   
        default:   
            minCoverage= 5;   
            break;
    There must be something obvious I am missing? Eternally grateful for advice on this.
    Stephen

    There are two issues in this script:
    1. You are not using the accessor 'value' to set form variables
    2. You are not correctly getting the value of the radio button list in the switch clause
    Please see the working script below.
    Ben Walsh
    www.avoka.com
    switch (this.rawValue) 
        case "1":                                       
            addLivingExp.value                  = "1";
            damageOthersProperty.value   = "2";
            liabilityIncl.value                      = "3";
            maxCoverage.value                 = "4";
            minCoverage.value                  = "5";
            persProperty.value                  = "6";
            relatedPrivateStruct.value        = "7";
            break;
        case "2":   
            addLivingExp.value                  = "10";
            damageOthersProperty.value   = "20";
            liabilityIncl.value                     = "30";
            maxCoverage.value                 = "40";
            minCoverage.value                  = "50";
            persProperty.value                  = "60"
            relatedPrivateStruct.value        = "70";
            break;
        case "3":   
            addLivingExp.value                 = "100";
            damageOthersProperty.value   = "200";
            liabilityIncl.value                     = "300";
            maxCoverage.value                 = "400";
            minCoverage.value                  = "500";
            persProperty.value                  = "600"
            relatedPrivateStruct.value        = "700";
            break;
        case "4":   
            addLivingExp.value                  = "1000";
            damageOthersProperty.value   = "2000";
            liabilityIncl.value                      = "3000";
            maxCoverage.value                 = "4000";
            minCoverage.value                  = "5000";
            persProperty.value                  = "6000"
            relatedPrivateStruct.value        = "7000";
            break; 
        case "5":   
            addLivingExp.value                  = "10000";
            damageOthersProperty.value   = "20000";
            liabilityIncl.value                      = "30000";
            maxCoverage.value                 = "40000";
            minCoverage.value                  = "50000";
            persProperty.value                  = "60000"
            relatedPrivateStruct.value        = "70000";
            break; 
        default:  
            minCoverage.value                 = 5;  
            break;

  • Grouping radio buttons in JEditorPane

    I can't seem to make grouping of radio buttons work for an html page that's loaded into a JEditorPane. The content type is set properly to text/html. Is there a little trick that I'm missing??
    Once I select a button that's not part of a previous group, it unselects that previous group anyway!!

    Hello There,
    I too am stuck up with the same problem. My HTML document contains two radio buttons which belong to the same group. But when displayed on a Jeditorpane the radio buttons does'nt behave as a part of a group. Both the radio buttons get selected. If you have come across a solution..please help me..
    Thanx
    Mohamed Zafer

  • Group Radio buttons controlling input fields

    Hi All ,
    I have 3 radio buttons which is grouped in teh form component . beside the 3 radio buttons i have 3 input fields , now i when i click the first radio button the input field beside the radio button should input enabled , rest of the input fields should be disabled ,
    Please share your ideas!!
    Thanks,
    Pradeep.

    Harsha ,
    This is the code in mu get_def method
    APPEND INITIAL LINE TO et_action_definition ASSIGNING <ls_action_definition>.
       <ls_action_definition>-id = 'ADDROW'.
       <ls_action_definition>-action_type = if_fpm_constants=>gc_action_type-validation_independent.
       <ls_action_definition>-imagesrc = '~Icon/AddRow'.
       <ls_action_definition>-VISIBLE = CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE.
       <ls_action_definition>-enabled = abap_true.
    I need the buttons in my list as below
    And in List UIBB i have added 2 buttons
    in the get def i am getting 2 records for add and del but dont know why i am not getting the buttons on screen .
    i have a edit page screen in that i have 2 UIBB , 1st Form UIBB and 2nd LIST UIBB , but when i click the form UIBB its showing as section 1, and the LIST UIBB also in the section1 , i don't think it will be the issue .

  • Grouping Radio Buttons on a Dialog Box

    Hi,
    Sorry to post this, I could not get any doc that could help.
    I have three groups of  radio buttons in a dialog box and, I set the Group property of each of the first radio button in a group to true. But it does not seem to work. Did I miss something?
    Thanks for your help.

    Found the solution:
    I Used 'ADMRadioGroupSuite1' Suite - RadioGroupSuite ("ADM Radio Group Suite") to group them. 

  • Group Radio Button

    Can someone give me info how to set couple radio buttons as one group? In other word, in UI, only one of them has enable state in the group.
    TIA,
    Mor

    Hi
    Have a look for ClusterPanelWidget in the fr file.
    Hans

  • RADIO BUTTON TALLY -Auto count & display ticked/selected radio buttons

    Hi, feels like this should be simple & straight forward, but obviously for me.
    I have a Questionnaire with say twenty YES or NO answers.
    I've used grouped Radio Buttons as fields so as to pick one or the other.
    I have a read only "YES Tally" text field at bottom of questionaire, formated as 'Number'.
    I want the form to automatically calculate & display the number of YES answers (radio buttons) selected or ticked.
    How can i achieve this?
    ZB.

    If you have your export value for the buttons set to "1" then you only need to use the calculation option "the field is the sum of: " calculation option., or you can use the 'simplified field notation' to sum the field names. If you use and a different value for the export value,then you need to write a custom script and either test for the export value of the "Yes" button or test for the export value not be "Off".

  • Variable drop-down lists according to radio-button input

    I need to restrict the display of drop-down lists according to a particular radio-button selection earlier on the form. Can I use a javascript call on the client side without linking to an external database along these lines:
    If radiobutton1 == 1
    then dropdownlist1 uses list1
    elseif radiobutton1 == 2
    then dropdownlist1 uses list2
    and so forth.
    Obviously the syntax is incorrect, but I need to know if it can be done before digging in further.

    Let's assume we have tree grouped radio buttons in a group of buttons, and a combo box object which displays a different list of elements depending of the chosen option.
    A very simple way to do it would be, for example, the following one:
    b [*] Radio Button Group - OnClick Event
    i // List of elements that will be loaded in the combo box object
    > var colorList = new Array("White","Blue","Red","Green");
    > var dayList = new Array("Monday","Tuesday","Wednesday","Thursday");
    > var tmarkList = new Array("Nike","Adidas","Reebook","Levis");
    i // ComboBox Object
    > var combo = xfa.resolveNode("Formulario1.ComboBox");
    i // Cleaning the combo...
    > combo.clearItems();
    > combo.addItem("Select one option to the list","");
    i // Filling the Combo
    i // "this" returns a button group where there are three radio buttons
    i // and the "rawValue" returns the selected index chosen in radio
    i // buttons.
    > switch(this.rawValue)
    > {
    > case "1":
    > for(nJ = 0; nJ < colorList.length; nJ++)
    > combo.addItem(colorList[nJ]);
    > break;
    > case "2":
    > for(nJ = 0; nJ < dayList.length; nJ++)
    > combo.addItem(dayList[nJ]);
    > break;
    > case "3":
    > for(nJ = 0; nJ < tmarkList.length; nJ++)
    > combo.addItem(tmarkList[nJ]);
    > break;
    >}

  • Disabling fields on the basis of radio button selected

    Hi experts,
    I have a requirement where in i have a dialogue screen which has radio buttons and few other input fields.
    when i check a radio button on the screen i have to get an input field greyed out on the same screen immediately.
    i have grouped the input fields to be greyed out as GR1.
    i used the following code in the PBO of the screen which is not working,
    if  oradio eq 'X'.
          loop at screen.
            if screen-name = 'S_CREATE'.
              screen-group1 = 'GR1'.
              screen-input   = 0.
            endif.
            modify screen.
          endloop.
    endif.
    please give some input.

    Hi
    *Hello Just do the Following.*
    *" I think you are missing the below Grouping Part otherwise your code looks ok*
    *go to EDIT -->Grouping--> Radio Button Group --> Define " before this select all the Radio Buttons.*
    *all the radio button names should be r1, r2, r3 etc as declared above " Make their names same whatever you give.*
    *" Assign a Function Code for them So that automatic PAI/PBO will Take Place once you select a radio Button*
    In TOP include/ Global area declare no of radio buttons.
    data : r1, r2, r3. etc " Default they take char with one length.
    if you are in Dialog program
    " I think you are missing the below Grouping Part otherwise your code looks ok
    go to EDIT -->Grouping--> Radio Button Group --> Define " before this select all the Radio Buttons.
    all the radio button names should be r1, r2, r3 etc as declared above " Make their names same whatever you give.
    " Assign a Function Code for them So that automatic PAI/PBO will Take Place once you select a radio Button
    in PBO
    module modify_screen.
    Now in Program
    Module modify_screen.
    if r1 = 'X'.
    loop at screen.
    if screen-group1 = 'GRP'.
    screen-input = 0 " or 1.
    modify screen.
    else" implement for other Radio buttons
    endloop.
    endmodule.
    Cheerz
    Ram

  • Issue in using radio button in module pool

    For same field I need 2 different search help. Based on radio button on screen I need company codeu2019s from different table. Issue is, at execution radio button remains blank. Radio button works only when I use them in PAI under CASE SY-UCOMM. WHEN u2018DONEu2019. IF Normal_Run = u2018Xu2019u2026u2026
    Can I use radio button with the below code. Please refer the below code.
    PROCESS ON VALUE-REQUEST.
    FIELD COMP_CODE MODULE POPULATE_COMP_CODE.
    MODULE POPULATE_COMP_CODE INPUT.
    IF REPEAT_RUN = 'X'.
    PERFORM COMP_CODE_POPULATE.
    ELSEIF NORMAL_RUN = 'X'.
    PERFORM COMP_CODE_POPULATE_N.
    ENDIF.
    ENDMODULE.  
    FORM COMP_CODE_POPULATE .
        SELECT COMP_CODE
          FROM  ZIFRS_D_PROCESS
          INTO  CORRESPONDING FIELDS OF TABLE VALUES_TAB_CC
          WHERE PROC_NAME = 'DEPRECIATION RUN'.
      READ TABLE VALUES_TAB INDEX 1.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          RETFIELD    = 'COMP_CODE'
          DYNPPROG    = PROGNAME
          DYNPNR      = DYNNUM
          DYNPROFIELD = 'COMP_CODE'
          VALUE_ORG   = 'S'
        TABLES
          VALUE_TAB   = VALUES_TAB_CC.
    ENDFORM.                    " COMP_CODE_POPULATION
    FORM COMP_CODE_POPULATE_N .
      CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
        EXPORTING
          TABNAME     = '/BI0/SCOMP_CODE'
          FIELDNAME   = 'COMP_CODE'
          DYNPPROG    = PROGNAME
          DYNPNR      = DYNNUM
          DYNPROFIELD = 'COMP_CODE'.
    ENDFORM.                    " COMP_CODE_POPULATE_N
    Moderator Message: Please use "code" tags to format the code snippet.
    Edited by: Suhas Saha on Nov 23, 2011 5:13 PM

    Hi
    You need to make the Grouping for these Radio button on the screen
    Search for how to make Radio buttons grouping
    radio buttons in screen painter
    http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCDWBTUT/BCDWBTUT.pdf
    and search for Radio button Group in this document
    assign a Function Code for one of the radio buttons(It allows for only one Radio Button)
    This triggers automatic PAI so when you take the F4 Help this is readily available
    In TOP include make sure you define the variables corresponding to the Radio buttons on the screen and also provide default value X to one of the Radio buttons
    Hope this serves your purpose
    Cheerz
    Ramchander Rao.K

  • How to handle two radio buttons in modulepool program

    hi,
      i am creating 2 radio buttons on the initial screen of a modulepool program, here i am unable ot handle those 2 radio buttons.
      when executing by default these two radio buttons are selected.
      pls send me the sample code that how to handle.

    Prasad,
    In the Screen Painter, highlight both radio buttons at the same time (using CNTL key).
    From menu bar, choose: Edit > Grouping > Radio Button Group > Define.
    Now they are "linked" to each other.
    Don;t forget those points.

  • Help:  Need to calculate a radio button when selected or not selected

    I am hoping its possible to use a script to calculate a radio button when it is selected.  For example:
    My form has 4 grouped radio buttons (Radio Button 1-4) of 5 buttons.
    So its something like this:
         Level 1     Level 2     Level 3     Level 4     Level 5
    1.   RB1          RB1            RB1           RB1         RB1
    2.   RB2          RB2            RB2           RB2         RB2
    3.   RB3          RB3            RB3           RB3         RB3
    4.   RB4          RB4            RB4           RB4         RB4
    Items areas total:               Total Points:               Average Score:
    The buttons already have different values set for each button to calculate a score in the "Total Points" text field. (Level 1 scores 1, Level 2 scores 2, etc.)
    I would like to have the "Items areas total" text field to calculate either a value of 1 if selected or a 0 if not selected.  So if 3 of the 4 rows are selected a return of "3" is calculated, if all 4 rows are selected then it returns "4", etc.
    Seems it would be a simple script.
    Thanks

    Hi Franklin,
    I understand that we can show the selected row in different color.
    But still there is a requiremnet given saying that there should be an radio button or Select button or check box (Checked only one at a time of several rows) apart from showing the selected row in a different color.
    Current display of the page:
    We have three regions, 1> Main region, 2> Master region, 3> Detail region.
    Main region has some text parameters, Master region has a adf:table and when ever you select a row on the master region the detail region values are getting refreshed based on the row selected.
    Is there any simple way apart from adding a boolean transient attribute to VO and displaying it as one of the column in adf:table?
    Thanks,
    Sandeep

  • How to set value for radio button in sap crm survey suite

    Hi ,
    I created a survey in CRM Service, in which I added a question with answer as '10 Selection Button Group ('radio button'). And answer has 11 answer options (which means 11 radio buttions). Now when we test the survey, the value for the radio buttons is appearing like 'id_0050569b03091ee480a29d8ee61e953c'. But i want to set a specific value for each radion button (from 1 to 11). So, how to set value for radio button in sap crm survey suite???.
    Thanks & Regards,
    Seshu

    Hi,
    I found solution myself. Click on Goto -> Editing Mode -> Expert Mode. Now you can set value for radio button.
    Regards,
    Seshu

Maybe you are looking for

  • Error message from delivery release to sales invoice drawing of data

    cannot post parent item with child item from delivery receipt to sales invoice error message is ar invoice rows- warehouse code lino:0 ],'no matching records found "inventory log message"] any suggestions on the remedy for this?

  • Internal Server Error; Live View not working...please help:)

    I am a beginner doing a tutorial through David Sawyer McFarlands' "CS5: The Missisng Manual.  I have MAMP set up and working fine.  I just got through doing a tutorial on editing a recordset and linking to a Detail page.  I have used Live View just a

  • Syntax Error after creating enhancements for subroutine

    Problem: Creating enhancement sections gives a syntax error when creating enhancement options and implementations for a subroutine and then ceating enhancement options and implementations for the call to that same subroutine. <p> Syntax Error: "Diffe

  • Videos not displaying after I move the project

    I had to move my project file to a new PC. I had videos linked in a few slides using progressive download and linking to the file. On a page with a video, the video just appears as a grey boc even though the link has the filename. How do i fix this -

  • LIVE encoding from osprey

    Hello, I am working on a project in which I have to encode 4 simultanous LIVE streams. How can this be done using FME?? Can one FME encode 4 simultanous streams or do I need 4 FME licenses?? Can it be done using one machine with a quad core processor