<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAP UI5 bindValue is not working in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaa-p/12430530#M4654289</link>
    <description>&lt;P&gt;Hi Prasad,&lt;/P&gt;&lt;P&gt;Replace your setModel statement with either of the above lines and your code should work.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;this.getView().setModel(objModel)  //or&lt;BR /&gt;this.getOwnerComponent().setModel(objModel);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;By default UI5 does not inherit models from the UI core. In order to do that you have to add the property &lt;STRONG&gt;propagateModel:true &lt;/STRONG&gt;to your ComponentContainer as shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;new sap.ui.core.ComponentContainer({
  name: "fennecd.webapp.Component",
  propagateModel: true
}).placeAt("content");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, setting model to UI core is not recommended as per the UI5 guidelines.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jun 2021 13:20:30 GMT</pubDate>
    <dc:creator>former_member752553</dc:creator>
    <dc:date>2021-06-21T13:20:30Z</dc:date>
    <item>
      <title>SAP UI5 bindValue is not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaq-p/12430528</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt; I am beginner in UI5 development. I am trying to bind a data from JSON model to the property of the element but it's not working. I can see data is being loaded but not assigned to the element. Help would be appreciated.&lt;/P&gt;
  &lt;P&gt;Here are the files below:&lt;/P&gt;
  &lt;P&gt;Thanks &lt;/P&gt;
  &lt;P&gt;PD&lt;/P&gt;
  &lt;P&gt;Models.js&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;sap.ui.define(
[
"sap/ui/model/json/JSONModel"
],
function(JSONModel){
"use strict";
return {

loadModel:function(){
 var oModel = new JSONModel();
 oModel.loadData("model/mockData/data.json");
 return oModel;

}
};
});//end of function&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;HTML index file:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta charset="utf-8"&amp;gt;
&amp;lt;title&amp;gt;SAPUI5&amp;lt;/title&amp;gt;

&amp;lt;script
id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_belize"
data-sap-ui-libs="sap.m"
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true"
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
data-sap-ui-resourceroots='{
"fennecd": "./"
}'&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;
&amp;lt;body id="content"&amp;gt;
&amp;lt;!--This module scans the DOM for HTML elements containing a special data attribute named data-sap-ui-component. 
All DOM elements marked with this data attribute will be regarded as container elements 
into which a sap/ui/core/ComponentContainer is inserted.--&amp;gt;
&amp;lt;div data-sap-ui-component data-name="fennecd" data-id="container" data-settings='{"id" : "idCont"}'&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;XML file:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;mvc:View
   controllerName="fennecd.controller.App"
   xmlns="sap.m"
   xmlns:mvc="sap.ui.core.mvc" 
   xmlns:simpleform="sap.ui.layout.form"
   displayBlock="true"&amp;gt;
  &amp;lt;Shell&amp;gt;
 &amp;lt;App&amp;gt;
      &amp;lt;pages&amp;gt;
      &amp;lt;Page title="{i18n&amp;gt;appTitle}"&amp;gt;
      &amp;lt;content&amp;gt;
        &amp;lt;simpleform:SimpleForm&amp;gt;
        &amp;lt;Label text="Business Name"&amp;gt;&amp;lt;/Label&amp;gt;
        &amp;lt;Input id="buz"&amp;gt;&amp;lt;/Input&amp;gt;
        &amp;lt;Label text="Address"&amp;gt;&amp;lt;/Label&amp;gt;
        &amp;lt;/simpleform:SimpleForm&amp;gt;
        &amp;lt;/content&amp;gt;
      &amp;lt;/Page&amp;gt;
      &amp;lt;/pages&amp;gt;
   &amp;lt;/App&amp;gt;
  &amp;lt;/Shell&amp;gt;
&amp;lt;/mvc:View&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Controller file:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
"sap/ui/core/mvc/Controller", "../model/models", "sap/m/MessageToast"
], function(Controller, Models, MessageToast) {
"use strict";
return Controller.extend("fennecd.controller.App", {
onInit: function() {
/*var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({
"business": {
"name": "XYZ",
"age": "12",
"salary": "100000",
"pin": "410020"
}
});
sap.ui.getCore().setModel(oModel);*/

var objModel = Models.loadModel();
sap.ui.getCore().setModel(objModel);
var oBuz = this.getView().byId("buz");
oBuz.bindValue("/business/name");
//oBuz.bindProperty("value", "/business/name");
MessageToast.show("Hi");
}
});
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Jun 2021 07:48:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaq-p/12430528</guid>
      <dc:creator>former_member1974</dc:creator>
      <dc:date>2021-06-21T07:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAP UI5 bindValue is not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaa-p/12430529#M4654288</link>
      <description>&lt;P&gt;See &lt;A href="https://stackoverflow.com/a/42251431/5846045" target="test_blank"&gt;https://stackoverflow.com/a/42251431/5846045&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 12:28:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaa-p/12430529#M4654288</guid>
      <dc:creator>boghyon</dc:creator>
      <dc:date>2021-06-21T12:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAP UI5 bindValue is not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaa-p/12430530#M4654289</link>
      <description>&lt;P&gt;Hi Prasad,&lt;/P&gt;&lt;P&gt;Replace your setModel statement with either of the above lines and your code should work.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;this.getView().setModel(objModel)  //or&lt;BR /&gt;this.getOwnerComponent().setModel(objModel);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;By default UI5 does not inherit models from the UI core. In order to do that you have to add the property &lt;STRONG&gt;propagateModel:true &lt;/STRONG&gt;to your ComponentContainer as shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;new sap.ui.core.ComponentContainer({
  name: "fennecd.webapp.Component",
  propagateModel: true
}).placeAt("content");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, setting model to UI core is not recommended as per the UI5 guidelines.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 13:20:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaa-p/12430530#M4654289</guid>
      <dc:creator>former_member752553</dc:creator>
      <dc:date>2021-06-21T13:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAP UI5 bindValue is not working</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaa-p/12430531#M4654290</link>
      <description>&lt;P&gt;Thank you for your replies.&lt;/P&gt;&lt;P&gt;I set my model at component&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;var oData = {
"business": {
"name": "xyz",
"age": 12,
"salary": 100000,
"pin": 411020
}
};
var oModel = new JSONModel(oData);
this.setModel(oModel);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and accessed directly at view/controller&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 14:06:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-ui5-bindvalue-is-not-working/qaa-p/12430531#M4654290</guid>
      <dc:creator>former_member1974</dc:creator>
      <dc:date>2021-06-21T14:06:24Z</dc:date>
    </item>
  </channel>
</rss>

