cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to get the values of selected row from sap.m.table?

Former Member
0 Kudos
10,652

Hello,

I am trying to read the data of a particular row from an sap.m.table using below code:

                    var selRowContext  = rowtable.getBindingContext(SelctdRow);

                  var rowmodel = rowtable.getModel();

                  SelectStatus = rowmodel.getProperty("Status", selRowContext);

but selRowContext doesn't support by m.tables, instead getProperty(Status) cannot be read as per the declaration defined in sdk.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

this is how we define in XML view:

var selRowIndex = rowtable.indexOfItem(oSelectedItem)+1;

and for Binding the context as Kuntal Sarkar explained above:


var path= oEvent.getParameter('listItem').getBindingContext().getPath();

var selectedRow= this.byId('Table_ID').getModel().getProperty(path);

Answers (1)

Answers (1)

former_member204155
Active Participant
0 Kudos

Hi Venkathesh,

for mTable I think this way it will work.

in the  controller onSelection function you can go like this.

var path= oEvent.getParameter('listItem').getBindingContext().getPath();

now you can use this path reference to locate any particular property values in your table model.

var selectedRow= this.byId('Table_ID').getModel().getProperty(path);

now as per your question to access the property "Status" just you need to do this..

selectedRow.Status



Hope it will help !!

Regard,

Kuntal Sarkar

Former Member
0 Kudos

hi Kuntal, thanks for your response, I have resolved the issue. Its working fine. Similar to the one which you explained above. thanks

former_member204155
Active Participant
0 Kudos

great!!

you welcome.

pls close the thread.

agentry_src
Active Contributor
0 Kudos

Please mark this Discussion with a Correct Answer (closes, but does not lock the Discussion) and Helpful Answer where appropriate. See http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why   Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be.  Do not use Assumed Answered as it confuses anyone looking for the specific answer.


Thanks, Mike (Moderator)
SAP Technology RIG