Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Retrieve the Key value of a sap.m.RadioButtonGroup (xml view) / oData Model

Hello Experts,

My challenge is to retrieve the Key value of a RBG in a Fiori app linked to an oData Service. From a Previous question I have obtained this answer:,output and it works fine in the json Model.

in my view.xml:

<RadioButtonGroup xmlns="sap.m"






<RadioButton text="{ATWTB}" key="{ATWRT}"/>


and the function in controller:

onSelectRadio: function(oEvent) {

var oSelectedIndex = oEvent.getParameter("selectedIndex");

var oModelo = this.getView().getModel();

var sKey  = oModelo.getProperty("/ZUI5_TEST_TVALUES_SET/"+oSelectedIndex+"/ATWRT");


After getting the Model in "oModelo"  (image from Debugger below), "Skey" still results in "undefined".

How can I obtain in this case the ATWRT value? (Key value) or this sap.m.RadioButtonGroup?

Thank you

PD I was able to retrieve the text value of a RBG (thanks to this post->how to bind the data for radiobutton group in XML view?) But now the question is about key value.


You can fetch the bindingContext from the instance of the selected item and get the data from the context.

onSelectRadio: function(oEvent) {

    var oSource = oEvent.getSource();

    var oContext = oSource.getSelectedButton().getBindingContext();

    var oData = oContext..getObject();



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question