on 08-20-2015 11:02 PM
Hi fórum
I have a SAP UI5 XML View that show the value of a Json Model .... in a Text Component
<Text xmlns="sap.m" id="iduser" text="{userapi>/displayName}"></text>
That´s work fine, but I want to setting the value of {userapi>/displayName} in a JavaScript Variable... how can i do that ?
In the "index.html" i have the next code... and in this part i need the JavaScript Variable with the value of "displayname".
var userModel = new sap.ui.model.json.JSONMODEL("/services/userapi/currentUser");
sap.ui.getCore.setModel(userModel, "userapi");
Thanks
hi Josue,
Try
var sDisplayName = sap.ui.getCore.getModel("userapi").getData().displayName;
Regards
Aasif Shah
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have two question relating to the currentUser
Thanks in advance!
Cheers
Jayant
Hi Josue
I believe this will work.
var userModel = new sap.ui.model.json.JSONModel("/services/userapi/currentUser");
userModel.attachRequestCompleted(function() {
this.setProperty('/displayName', 'Me');
});
sap.ui.getCore().setModel(userModel, "userapi");
Thanks
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
var userModel = new sap.ui.model.json.JSONMODEL({ displayName : "Josue" });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.