Skip to Content
0
Nov 06, 2015 at 05:01 AM

How to take ObjectAttribute value from view while click the ObjectListItem

1145 Views

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);

},