Skip to Content
avatar image
Former Member

sap.m.RadioButton with Group Name SAPUI5

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}" })
] });
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jul 11, 2017 at 11:02 PM

    does this help?

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

    thanks

    -D

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 12, 2017 at 08:39 AM

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

    Regards,

    Sharath

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 12, 2017 at 07:37 AM

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

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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

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

  • avatar image
    Former Member
    Jul 12, 2017 at 08:32 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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