javascript - Set the ID of View and TextView in titanium appacelerator -


i'm creating create randomly textareas need know textarea pressed user.

is there way enter unique id each textarea?

how create textview:

var txtarea = ti.ui.createtextarea({   color : '#000',   backgroundcolor : 'transparent',   font: {     fontsize : 28,     fontweight : 'normal',   },   editable : false,   textalign : 'left',   value : a[i],   textalign : 'center',   top : '30%',   width : '100%',   height : '100%' }); 

i tried put "id : i", textareas returned same id.

it's not suggested add custom properties titanium proxies. here (based on guess of try achieve):

for(var = 0; < 10; i++){     var txtarea = ti.ui.createtextarea({         value : "test n " + i,         textalign : 'left',         textalign : 'center',         top : '30%',         width : '100%',         height : '100%'     });     (function(){         var id = i;         txtarea.addeventlistener('click',function(){             console.log(id);         });     })(); } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -