cancel
Showing results for 
Search instead for 
Did you mean: 

Help need for sap.m.InputListItem data to access

Former Member
0 Kudos

Hi All,

I am new to SAP UI5 and having small doubt.

We are showing list using SAP.M.InputListItem in one JS file where we are having data in oBarcodeItemList.

Now at the same list we do have one button on which we open some other JS so now above data is not available.
So we did like this:

Window.findguid    =      oBarcodeItemList.

Now Window.findguid is available in another JS.

Could you please help me how to get loop on this (Window.findguid) data and search any string (Ex: XYZ) available in this table data or not.

Thanks,

Jaten

Accepted Solutions (0)

Answers (2)

Answers (2)

karthikarjun
Active Contributor
0 Kudos

Hi Jaten Sangal,

Try JSON Model Concepts.

Ex:

var MyPrevArray = {"name": "Jaten", "Class" : "SAP" };

var JSON = new sap.ui.model.json.JSONModel(MyPrevArray );

this.getView().setModel(JSON,"MyModelName");

//Other End:

sap.m.listItems({

items : {

path : "MyModelName>/",

//Access your record

}

})

Thanks,

Karthik A

santhu_gowdaz
Active Contributor
0 Kudos

You can use sap.ui.getCore().AppContext(ui5 provided as global variables) instead of window.

sap.ui.getCore().AppContext.Array = your list of values.

i tried,

sap.ui.getCore().AppContext=new Object();

  sap.ui.getCore().AppContext.Array = ['dsfdsf','2gereh','3dsfd'];

  console.log(sap.ui.getCore().AppContext.Array);

console.log(sap.ui.getCore().AppContext.Array.length);

  console.log(sap.ui.getCore().AppContext.Array[0]);

my console is showing,

["dsfdsf", "2gereh", "3dsfd"]

3

dsfdsf

so you can loop it as below,

for(var i=0;i< sap.ui.getCore().AppContext.Array.length;i++)

     alert( sap.ui.getCore().AppContext.Array[i]);