on 11-26-2014 12:25 PM
Hi,
I have an XML view defined as below.
<List id="ticketList" items="{/tickets}" mode="{device>/listMode}"
select="handleListSelect">
<items>
<ObjectListItem type="{device>/listItemType}" press="onSelect"
title="{CallRef}">
<attributes>
<ObjectAttribute text="{Mestyp}" />
</attributes>
<firstStatus>
<ObjectStatus text="{Status}"
state="{
path: 'Status',
formatter: 'efforttool.util.formatter.ratingState'
}" />
</firstStatus>
</ObjectListItem>
</items>
</List>
Now, I am invoking an AJAX call to get some JSON back. I want to be able to bind this JSON to the above list and am having difficulty in doing it.
I can get a variable pointing to the above list using the following code: -
ticketList = sap.ui.getCore().byId("idViewRoot--idViewMaster--ticketList");
But I do not kow what additional code to add to get my JSON respose bound to this list that was defined using an XML view.
Any help is much appreciated.
Thanks
Martin
Hi Martin, first you need create a model from json response and then set the model to list. Check this example: JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type=&q...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pau,
I have used this logic to create the model from the return JSON data
ticketModel = new sap.ui.model.json.JSONModel();
ticketModel.setData(json);
Now how can I bind this to the XML list that is defined in the view.
As I mentioned earlier I am getting a reference to the list using the following code
ticketList = sap.ui.getCore().byId(
"idViewRoot--idViewMaster--ticketList");
I do not know how to bind my model to the list object.
Thanks
Martin
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.