Skip to Content

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

Display Information on the basis of Selected Row

Hello All,

I am trying to create one sample application with Element Binding in which when the user selects any row in the table in another view it displays the information on the basis of selected Row. I know on there are many threads and sample code for this, but I am not able to understand, I don't want to copy-paste the code. If someone could explains the steps it would be much appreciable.

Lets assume we have one JSON Model :

var data =                '{  "Leaders": [

                                    {"fName": "Sonia","lName":"Gandhi", "id" : "1"},

                                    {"fName": "Narendra","lName":"Modi","id" : "2"},

                                    {"fName": "Rahul","lName":"Gandhi","id" : "3"},

                                    {"fName": "Sushma","lName":"Swaraj"},"id" : "4" ],

                                    "Party" : [

                                    {"Party_Name": "Congress"},

                                    {"Party_Name": "BJP"},


Please someone can explain how can I achieve this when user select any row of first table , it gives the information about the party name.



Former Member

Hi Mayank,

The first and foremost thing is to have the API open. Now for example, we are dealing with sap.m.Table open the table API: JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.m.Table

If you refer API, you can see properties, aggregations and events that are associated with table. Now your question is with regard to the selectionChange event that I have used. If you navigate to the selectionChange event you can see what methods are available for the event object that has been passed through function. For example I have written code like this -

var oTable = sap.ui.getCore().byId("oTable");          //Your Table

oTable.attachSelectionChange(function(oEvent){        //Events expect function

               var oMode = oEvent;                       


Now I will on my debugging mode and have a breakpoint at line var oMode = oEvent; in chrome and check what does my oEvent object contains in the console -

When I select on the list Item, it will hit the break point which is placed at selection event and then from there I check what methods are available like getParameter(), getParameters(), getSource() etc. Since, getParameters() will fetch all the parameters but I just need one parameter so I used getParameter("listItem"); Check the below snip, how I nailed through -

It is just a matter of time, once you understand how to use API , how to debug and having the basics right. Then it will be easy to code. Just keep practising, you will understand the concepts.


Sai Vellanki.

0 View this answer in context

Helpful Answer

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