user3349850
user3349850

Reputation: 225

sap ui5 object header binding

i have set a global model for a list item as below

in controller init method

var data = {
        A1: [
            {"id":"1","Type":"Incidents","Ticket":"P1-P2","value":90 },
            {"id":"2","Type":"Incidents","Ticket":"P1-P2","value":93  },
            {"id":"3","Type":"Resolution Time PM","Ticket":"P1-P2","value":96 },
            {"id":"4","Type":"Resolution Time BS","Ticket":"P1-P2","value":70  },
            {"id":"5","Type":"Resolution Time SCI","Ticket":"P1-P2","value":83 },
            {"id":"6","Type":"Incidents","Ticket":"P1-P2","value":90 },
            {"id":"7","Type":"Incidents","Ticket":"P1-P2","value":93  },
            {"id":"8","Type":"Resolution Time PM","Ticket":"P1-P2","value":96 },
            {"id":"9","Type":"Resolution Time BS","Ticket":"P1-P2","value":70  },
            {"id":"10","Type":"Resolution Time SCI","Ticket":"P1-P2","value":83 },
            {"id":"11","Type":"Incidents","Ticket":"P1-P2","value":90 },
            {"id":"12","Type":"Incidents","Ticket":"P1-P2","value":93  }]
    var oModel = new sap.ui.model.json.JSONModel();  
    oModel.setData(data);  
    sap.ui.getCore().setModel(oModel,'model_tickets');
    this.List_tickets.setModel(oModel);
    this.List_tickets.bindAggregation("items","/A1",this.List_ticketsTemplate);

in view createcontent

    oController.List_tickets = new sap.m.List("List_tickets",{}),
        oController.List_ticketsTemplate = new sap.m.ObjectListItem("tickets",{
        title : "{Type}",
        number: "{value}"
         press : oController.NavtoTicketDetails,
        attributes : [new sap.m.ObjectAttribute({
        text : "{Ticket}",
            })],

onpress event of Listitem the app navigates to object header page where more details of the list item is displayed where id of list is passed as attribute in routing in other page

how can be filter the global model for selected id and assign to object header basically binding the object header with selected list item values.

Upvotes: 0

Views: 2310

Answers (1)

Bernard
Bernard

Reputation: 1238

You say you can get the id. Then you should bind the object header page to the selected item. (You could specifically bind the list too if you prefer).

this.getView().bindElement("model_tickets>/A1/" + id);

Also not that the syntax of your bindings should be prefixed by the named model name:

...
        title : "{model_tickets>Type}",
        number: "{model_tickets>value}"
...
        text : "{model_tickets>Ticket}",

Hope this helps

Upvotes: 1

Related Questions