Updating array values (Appcelerator Titanium Mobile) -
i'm using both 1.5.1 , 1.6.0 test apps on os x.
i'm trying update values in array:
var mytab = [ {title:'foo1',value:'bar1'}, {title:'foo2',value:'bar2'} ];
if update value field in array, doesn't (which isn't normal):
titanium.api.info('before :' + mytab[0].value); mytab[0].value = 'updated!'; titanium.api.info('after :' + mytab[0].value);
it displays 'bar1' instead of 'updated!'. tried next put tab property list:
titanium.app.properties.setlist('proptab',mytab);
and then, tried same thing:
titanium.api.info('before :' + titanium.app.properties.getlist('proptab')[0].value); titanium.app.properties.getlist('proptab')[0].value = 'updated!'; titanium.api.info('after :' + titanium.app.properties.getlist('proptab')[0].value[0].value);
same result: displays 'bar1' instead of 'updated!'.
is there solution?
thank you,
regards
i've run sort of behavior before. while never ascertained cause, found workaround: need set mytab[0]
value, , not mytab[0].value
value. so, thus:
mytab[0] = {title: mytab[0].title, value: "updated!"};
why, not know... should figure out.
Comments
Post a Comment