Skip to Content
0
Sep 18, 2019 at 01:33 PM

Problem to bind ObjectListItem

50 Views

Hello,

First of all, I'm new in sap Fiori development.

I have an issue to bind one ObjectListItem. I need to get information of one material after input.

I decided to get the data with JSONModel, it works perfectly but when i tried to do

this.getView().setModel(JsonModel, "infos_etq");

nothing is happening..

this is my controller code :

var JsonModel = new sap.ui.model.json.JSONModel();       
var serviceUrl = this.ODataServiceUrl + "/EtiquetteSet('1')";       
JsonModel.loadData(serviceUrl, null, false);         
this.getView().setModel(JsonModel, "infosETQ");

And my view code :

<List items="{/EtiquetteSet}" id="infos_etq">             
<items id="items">               
<ObjectListItem xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core.core" xmlns:tnt="sap.tnt" xmlns:form="sap.ui.layout.form" xmlns="sap.m" title="Infos étiquette">                 
   <attributes>                   
      <ObjectAttribute text="{Matnr}" id="matnr" title="Article"/>                   
      <ObjectAttribute text="{maktx}" id="maktx" title="Description"/>                   
      <ObjectAttribute text="{Charg}" id="charg" title="Lot"/>                   
      <ObjectAttribute text="{vfdat}" id="peremption_date" title="Péremption"/>                   
      <ObjectAttribute text="{Zqty} {Meins}" id="qty" title="Quantité"/>                   
      <ObjectAttribute text="{Zetiq}" id="zetiq" title="Etiquette"/>                 
   </attributes>               
</ObjectListItem>             
</items>           
</List>

Can someone help me with my issue pls ?