javascript - Accessing JSON object in SAPUI5 via xsodata -
i try access value of json objects in sap ui5, getproperty function cannot access required data. but, @ first, have created xsodata file service definitions, e.g.
"customer_attr_g3" "customers";
then try these data in view.js file following code:
omodel.loaddata("userinterface_g3/services/customer_attr_g3.xsodata/customers?$select=customer_id,customer_description&$format=json");
when using console.log(omodel) see in odata section values in object cannot access them. following screenshot should show structure of object:
i tried instance:
console.log(omodel.getproperty('/customer_description'));
or
console.log(omodel.getproperty('results/customer_description'));
but cannot access values of object.
does have idea on that?
console.log(omodel.getproperty('results/customer_description'));
you need access property that:
console.log(omodel.getproperty('d/results/0/customer_description'));
you forgot position inside of array. path needs position, if want first entry cs_0001
have write result/0/customer_description
.
edit:
actually depends on model, how have access property. can pls show me how defined omodel?
Comments
Post a Comment