on 02-27-2013 4:51 AM
Hi,
I followed this (http://scn.sap.com/community/developer-center/front-end/blog/2012/06/01/sample-application-using-ui5...) guide to create an SAPUI5 app getting data from the ECC server. We have gateway installed in our ECC system.
As per the document, when I select a user from the table, it should show the user's roles and profiles in different tabs. But when I select a user, I am not getting the roles or profiles - the table just says No data.
Here is the code I am using:
//on select of record call the ODATA READ service and show more details about user. | |||||||
userDetailsTable.attachRowSelect(function(oEvent) | |||||||
{ | |||||||
var currentRowContext = oEvent.getParameter("rowContext"); | |||||||
var selectedUserID = oModel.getProperty("username", currentRowContext); | |||||||
//Here I am using datajs API to call the READ operation and setting the values to individual UI elements. | |||||||
OData.read("http://gatewaysrvr:8000/sap/opu/odata/sap/Z_USER_RFC_RIS/z_user_rfc_risCollection('"+selectedUserID+"')", | |||||||
function (response) | |||||||
{ | |||||||
sap.ui.getCore().getControl("title_cb_m").setValue("Mr."); | |||||||
sap.ui.getCore().getControl("firstname_tf_m").setValue(response.firstname); | |||||||
sap.ui.getCore().getControl("lastname_tf_m").setValue(response.lastname); | |||||||
sap.ui.getCore().getControl("language_tf_m").setValue(response.language); | |||||||
sap.ui.getCore().getControl("department_tf_m").setValue(response.department); | |||||||
sap.ui.getCore().getControl("telephone_tf_m").setValue(response.telephone); | |||||||
sap.ui.getCore().getControl("e_mail_tf_m").setValue(response.e_mail); | |||||||
sap.ui.getCore().getControl("country_cb_m").setValue(response.country); | |||||||
sap.ui.getCore().getControl("city_tf_m").setValue(response.city); | |||||||
}); | |||||||
//userProfileDetailsTable.bindRows(currentRowContext+"/profiles_r");//(You can use the below syntax also) | |||||||
userProfileDetailsTable.bindRows("/z_user_rfc_risCollection('"+selectedUserID+"')"+"/profiles_r"); | |||||||
//The beauty is, you need not to map individual columns. Based on the value field mapping table column and fields in OData service it automatically maps the data. | |||||||
//userRolesDetailsTable.bindRows(currentRowContext+"/activitygroups_r");//(You can use the below syntax also) | |||||||
userRolesDetailsTable.bindRows("z_user_rfc_risCollection('"+selectedUserID+"')"+"/activitygroups_r"); | |||||||
}); |
I am able to access this service from browser:
Please let me know how to get the data to a table when I select a particular row.
Thanks,
Rishi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Solved it...yay!!!
The model had to be set to the table, before binding it.
Used the below code:
userProfileDetailsTable.setModel(oModel); | ||
userProfileDetailsTable.bindRows("/z_user_rfc_risCollection('"+selectedUserID+"')/profiles_r"); |
userRolesDetailsTable.setModel(oModel); | ||
userRolesDetailsTable.bindRows("/z_user_rfc_risCollection('"+selectedUserID+"')"+"/activitygroups_r"); |
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.