on 11-06-2015 5:01 AM
Hi All,
I'm Working in SAPUI5 application there i'm using ObjectListItem to display the data. In that i add some Object attributes, while click the list item need to take the value from it. I tried some code, when i assign some value to the variable it shows the data, but i give the oData field means it won't show data.
Code Snippet:
omaster.view.js
var empno=new sap.m.ObjectAttribute("empno", {text:"EmployeeNumber"});
var trpno=new sap.m.ObjectAttribute("trpno", {text:"{Tripnumber}"});
var sendlist=new sap.m.ObjectListItem("sendlist", {
title:"{Nameown}",
number:"{Used}",
numberUnit:"{Days}",
type : "Active",
press:oController.Detail,
attributes : [new sap.m.ObjectAttribute({
text : "{CurrNotice}"
}),empno,trpno
],
});
omaster.controller.js
Detail:function(){
var iempp=sap.ui.getCore().byId("empno").getText();
var trpnop=sap.ui.getCore().byId("lab").getText();
alert(iempp);
alert(trpnop);
},
Hi,
Will this help?
JS Bin - Collaborative JavaScript Debugging
On click of the list you should do this.
Detail:function(evt){
console.log(evt.getSource().getAggregation("attributes")[0].getBindingContext().getProperty("Tripnumber"))
},
Tripnumber : property name of your model
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your response it's work fine now..
Hi Vinoth,
Try like this -
var objectListItem = sap.ui.getCore().byId("sendlist"); //Get Hold of ObjectListItem
var objectAttributes = objectListItem.getAggregation("attributes"); //Get Object Attributes Array
objectAttributes[0].getText(); //CurrNotice
objectAttributes[1].getText(); //EmployeeNumber
Check sample: Plunker
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sai Vellanki,
Sorry yar, I tried your code but i shows empty data only
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.