on 07-02-2013 12:21 PM
var mm = new sap.ui.model.json.JSONModel();
mm.loadData("/test/deputy/handler/init",true,"GET",false,"true",null);
sap.ui.getCore().setModel(mm);
.....
-
then I want to get data from the model;
//
var me = mm.getProperty("/startBy");
dosomething(me);
...
But got me : undefined
the json data like this:
{"formId":null,"formName":null,"startBy":"00091897","applicant":null,"deputy":null,"startDate":"2013-07-02","endDate":"2013-07-02","posId":null,"appType":null,"reasonType":null,"reasonText":null,"nameA":null,"nameB":null,"comments":null}
Anyone can help me?
Hi Shen,
this could be a matter of "timing". When calling the "loadData" method, you trigger an async request. This means, that when you try to get a property from the model there is no guarantee that the data is loaded already. You might consider registering an event handler on the "RequestCompleted" event of the model. Please refer to the API reference for more details.
Regards, Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.