cancel
Showing results for 
Search instead for 
Did you mean: 

List of RadioButtonGroups anyone?

SergioG_TX
Active Contributor
0 Kudos

Hello,

thank you for reading this question. I am encountering an issue while trying to create a List of radio button groups.

When I try to create only one radio button group, it works fine even reading data from a named model.

my named model is appModel and it looks like this


appModel: {

     // some properties

    , first: {

       options: [

          { q: "abc", sel: true } ,

          { q: "abdc", sel: false}

       ]

    },

    qList: [

             {

                 "descr": "abc",

             "qs": [

               { "q": "abc", "ans": true },

               { "q": "abceew", "ans": false },

               { "q": "abcd", "ans": false }

             ]

             },

         {

             "descr":"deee",

             "qs" : [

                 { "q": "abcddddd", "ans": true },

               { "q": "eeeee", "ans": false }

             ]

         }

     ],

}

and my 1 Radio button group which is working looks like this:


<RadioButtonGroup buttons="{appModel>/first/options}" columns="4" width="500px" class="sapUiMediumMarginBottom">

           <buttons>

               <RadioButton groupName="a" text="{appModel>q}" selected="{appModel>sel}" />

           </buttons>

    </RadioButtonGroup>

now, i have tried wrapping this RadioButtonGroup in a List object but the aggregation control is items therefore the radio button group is not the same.

I have also tried using the VBox and using the binding property as shown on the explored tab and i am not able to get it to work.


<VBox binding="{appModel>/qList}" >

   <Text text="{appModel>descr}" textAlign="Center"/>

    <!-- radio button group -->

</VBox>

has anyone else tried to create a list of radio button groups? 

On a similar note, I have create a list of NotificationListGroup controls and i was able to find that using the additional property templateShareable inside the items attiribute for this control. I attempted to do the same here but i had no luck .

thank you in advance

Accepted Solutions (1)

Accepted Solutions (1)

yogesh_beria
Explorer
0 Kudos

Hi Sergio,

As you mentioned, since the list control's items aggregation only takes controls inherited from the listitembase class, you will not be able to add a radio button group directly.

You can wrap your radiobuttongroup in a customListItem and then add that to your list.

The approach with VBox should work. The aggregation is called "items".

I think you need to replace '<VBox binding="appModel>/qList">' with <VBox items="appModel>/qList">'.

You can check the snippix for more details. I just used an inputListItem for Simplicity but you can create your own customItem.

http://veui5infra.dhcp.wdf.sap.corp:8080/snippix/#29031

Regards,

Yogesh

former_member182862
Active Contributor
0 Kudos

My first guess is that groupName="a" is the problem

When we have the radio group is an aggregation, they all have the same group name.

-D

Answers (1)

Answers (1)

SergioG_TX
Active Contributor
0 Kudos

Indeed, I need to have the correct groupName (different per radio button group), plus I wrapped my radio button group control with a CustomListItem control and further, the List control needed a property called templateShareable: true as follows:


<List items="{ path : 'appModel>/qList' , templateShareable: true}">

     <CustomListItem>

            <RadioButtonGroup buttons="{appModel>qs}">

                    <buttons>

                              <RadioButton groupName="appModel>gn" text="{appModel>q}" />

                    </buttons>

            </RadioButtonGroup>

    </CustomListItem>

</List>