Kiran
Kiran

Reputation: 345

Passing array object from one window to another

Passing array content value into another window array content.

Window FirstWindow

 var firstData = [ {title:'Abcd',disc:'1234'},{title:'egg',disc:'567'}];

second Window

var secondData = [];

How to pass FirstWindow object into second window array object Titanium

var window  = Alloy.createController('SecondWindow').getView();
window.secondData = firstData;
open.Window();

For me its not working when open window its still empty.

@thanks in advance

Upvotes: 2

Views: 1845

Answers (1)

hini
hini

Reputation: 240

you can try this in the second window

this.secondData = [];

and it should work.

or

var secondData = [];
this.setSecondData = function(e){
    secondData = e;
}

and on the first window:

var c = Alloy.createController('SecondWindow')  
c.setSecondData(firstData);
var window  = c.getView();

Alternatively you can pass any arguments in the createController function: createController

Upvotes: 1

Related Questions