Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8556

SAPUI5 Text Field oData Model Binding

$
0
0

Hi Guys,

 

I am looking to bind an oData Model to a text Field. I have manage to bind the values using static index values like in the below sample.

 

  var oText2 = new sap.ui.commons.TextField("txtCustomerId",{

  // value: "{/pHeader/0/PROJECTID}",

   tooltip: "CUSTOMERID",

   width:"200px",

   editable:false});

   oText2.bindProperty("value", "CUSTOMERID");

   oText2.setModel(oModel);

   oText2.bindElement("/pHeader('100000000')");

 

But I am really looking to get this value after a super search in field search. I have tried using some methods unsuccessfully. Has anyone got some tips how can I achieve this requirement.

 

I have included my code in JSbin and below follow for quick view.

 

JS Bin

 

   var oLayout = new sap.ui.commons.layout.MatrixLayout();

 

   var oModel2 = new sap.ui.model.odata.ODataModel("xxxxxxxxx/pHeader2.xsodata/", true);

 

   var updatePanel4 = new sap.ui.commons.Panel({id:"updPanel4", collapsed: true}).setText('Project View');

    oView = new sap.ui.commons.layout.MatrixLayout("mView1",{columns: 4} );

 

    

      //var value = sap.ui.getCore().getModel("oModel2").getData().pHeader[0]/Property

     // var Context = value;

      var Context = "100000000";

 

   var oText1 = new sap.ui.commons.TextField("txtProjectId",{

  // value: "{/pHeader/0/PROJECTID}",

   tooltip: "PROJECTID",

   width:"200px",

   editable:false});

   oText1.bindProperty("value", "PROJECTID");

   oText1.setModel(oModel2);

   oText1.bindElement("/pHeader('"+Context+"')");  

   var oLabel = new sap.ui.commons.Label("lblprojectId", {text: 'Project ID', labelFor:oText1});


Viewing all articles
Browse latest Browse all 8556

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>