on 11-11-2013 6:30 PM
Hi,
I would like to read the data from the selected row in SAPUI5 table. I have defined a table in JS view as:
var
sysTable = new DataTable({
title:
"SAP System List",
visibleRowCount: 10,
selectionMode: SelectionMode.Single,
editable : true
});
The table is binded to JSON data
sysTable.bindRows("/SystemDetails");
I have also used the attachRowSelect function to get the selected row indices.
sysTable.attachRowSelect(function(oEvent){
oSystemDetailsML.bindContext(
"/SystemDetails/" + sysTable.getSelectedIndices());
});
Lets say the table has two columns as "SysID" and "Description". I am not able to read the data for the selected row.
Tried using the command alert(sap.ui.getCore().byId("SysID").getValue()); but not sure how this will read the data from selected row.
Thanks,
Yomesh
Hi Yomesh,
You have two options for selecting a value from table....
1. You want to get a value for single select
2. You want to get values for multi-select (you will need to use array in this case)
The following code is for single select:
sysTable.attachRowSelect(function(oEvent){
var currentRowContext = oEvent.getParameter("rowContext");
var selSysId = oSystemDetailsML.getProperty("SysID", currentRowContext);
var selDesc = oSystemDetailsML.getProperty("Description", currentRowContext);
});
Now if u say var selIndices = oEvent.getParameter("rowIndices"), this will return you an integer array which u can use like this :
selSysId = oSystemDetailsML.oData.SystemDetails[selIndices[0]].SysId;
Regards,
Shubham Agrawal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shubham,
I am trying to show data of a listitem to a popover window. After clicking on the listitem the data will appear on the popover window in some input fields. I am using sap.m library. Can you please show me some example how can I do that?? I have posted a quarry on the same problem..
Thanks
Himadri
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.