on 09-18-2019 2:33 PM
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 ?
Hello,
As you are using named model, u need to use model name as well like below :
<List items="{infosETQ>/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="{infosETQ>Matnr}" id="matnr" title="Article"/>
<ObjectAttribute text="{infosETQ>maktx}" id="maktx" title="Description"/>
<ObjectAttribute text="{infosETQ>Charg}" id="charg" title="Lot"/>
<ObjectAttribute text="{infosETQ>vfdat}" id="peremption_date" title="Péremption"/>
<ObjectAttribute text="{infosETQ>Zqty} {Meins}" id="qty" title="Quantité"/>
<ObjectAttribute text="{infosETQ>Zetiq}" id="zetiq" title="Etiquette"/>
</attributes>
</ObjectListItem>
</items>
</List>
Regards
Rakesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you have to check what is inside of JsonModel
if you load odata, it probably has structure like d.results
<List items="{infosETQ>/d/results}" id="infos_etq">
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.