cancel
Showing results for 
Search instead for 
Did you mean: 

Bind a tri-state radio button to a model

former_member190655
Participant
0 Kudos

Hi All,

I have a requirement to create a table with a column called as decision. This field has 3 states for it - Yes, No & Maybe. Now I have create this control for all rows of table and bind the selected value to field in model - which is called as "decision".

My model structure is like this -

oModel = {

    data: [

          {name: "AA", amount: "99.00", decision: ""},

          {name: "BB", amount: "22.00", decision: ""},

    ]

}

I know, I have to use sap.m.RadioButtonGroup and combination of radio button(s) control. But, could you please let me know, how to bind the selection by user in the model dynamically? As on save/submit, button press, I just want to use this whole model i.e. oModel->data and send it to backend for update. Please help me with some pointers or code snippets.

Regards,

Chet

Accepted Solutions (1)

Accepted Solutions (1)

karthikarjun
Active Contributor
0 Kudos
former_member190655
Participant
0 Kudos

Brilliant mate .. Cheers

<that was quick>

I figured out myself that, selectedIndex was the key to solution, but I was struggling to set the correct binding back to data model.

Thanks a tonne.

Chet

Answers (1)

Answers (1)

saivellanki
Active Contributor
0 Kudos

Hi Sharma,

You mean something like this? Plunker

Regards,

Sai Vellanki.

former_member190655
Participant
0 Kudos

Thanks Sai

Yours and Karthik's answers are both correct and use similar patterns.

I just used Karthik's - and it is working now.

Thanks for prompt reply.

Chet

saivellanki
Active Contributor
0 Kudos

Hi Sharma,

Good!

Please give proper credits by marking Karthik's answer as correct, since you used his code.


Thank you!

Regards,

Sai Vellanki.