Skip to Content
0

sap.m.RadioButton with Group Name SAPUI5

Jul 11, 2017 at 08:50 PM

162

avatar image

Hello UI5 experts,

Very simple issue - I have used sap.m.Radiobutton with groupName as unique string but all the radio buttons are enabled for selection.

I am using this as template while binding table and my requirement is to let the user choose only one radio button in a row.

var oColumnList1 = new sap.m.ColumnListItem({
  id: "idTemplateList1",
  cells: [ new sap.m.Text({ text: "{ShortText}" }),
    new sap.m.RadioButton({ selected: "{Rating1}", groupName : "{Group}" }),
    new sap.m.RadioButton({ selected: "{Rating2}", groupName : "{Group}" }),
    new sap.m.RadioButton({ selected: "{Rating3}", groupName : "{Group}" }),
    new sap.m.RadioButton({ selected: "{Rating4}", groupName : "{Group}" }),
    new sap.m.RadioButton({ selected: "{Rating5}", groupName : "{Group}" })
] });
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Dennis Seah
Jul 11, 2017 at 11:02 PM
0

does this help?

http://jsbin.com/pulenom/edit?js,output

thanks

-D

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thank you Dennis..

Actually, my Radio buttons are working fine. When I enabled the OData model with two way binding, weird behavior has started.

Should I consume OData in JSON format [by default Two way binding] and try capturing the user selections.?

0

You can have oData in any format (JSON or not). You need to alter the select function in my example accordingly.

Thanks

-D

0

Better to capture in JSON format and then pass it to oData

0
Sharath M G Jul 12, 2017 at 08:39 AM
0

So, if you have assigned a group and perform the operation of getSelectedItem(), don't you get the selected radio button item?

Regards,

Sharath

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello Sharath,

Method getSelectedItem( ) doesn't give any results as we are not selecting the table row.

0

I get your issue now. Try to get the radio button group by group ID or group name and get its selected radio button id.

0
devender Naik Jul 12, 2017 at 07:37 AM
0

It should come, check whether group contains value at runtime,

otherwise provide some unique value to the list group for every entry.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Actually, my Radio buttons are working fine. When I enabled the OData model with two way binding, weird behavior has started.

0
Mohammad Rizwan Jul 12, 2017 at 08:32 AM
0

Now, my actual issue is to capture the radio button selected and update the model data.

For instance, I have to identify the radio button selected in the table below and update data accordingly. Finally, I have to capture all the table data and save it to back end.

capture8.jpg


capture8.jpg (33.5 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

to save to backend you have any event eg : button press...in this case, since you are updating multiple entries you should use $batch, also check the odata version you are using while using $batch

0