Skip to Content
0
Jan 30, 2021 at 12:36 PM

JSON model - Loading of data failed undefined - SAPUI5

438 Views

Hi,

Object page layout.

Created a JSON model and imported it into controller.

onInit: function () {
 var oModel = new JSONModel("../model/data.json");
 this.getView().setModel(oModel, "portfolio");
 }

Tried using it in the view, but the model is not loading it seems. Title is not showing.

<ObjectPageLayout id="ObjectPageLayout">
 <headerTitle>
   <ObjectPageDynamicHeaderTitle>
     <expandedHeading>
       <m:Title text="{portfolio>/name}" wrapping="true"/>
     </expandedHeading>
     <expandedContent>
       <m:Text text="{portfolio>/designation}"/>
     </expandedContent>
     <snappedContent>
       <m:Text text="{portfolio>/designation}"/>
     </snappedContent>
-----------

Console:

Debugger:

Also i have one more doubt:

when to use the below in JSON Model binding:

1) >/ (portfolio>/name)

2) > (portfolio>name)

3) / (portfolio/name)

Attachments

9x37yfhdfh.png (69.5 kB)
h5acvqioba.png (36.3 kB)