hi all i want to get selected row value into textfield so how can i copy the value into the textfiled. so how can i do this...my_combo is textfiled Code -:
var Tab_data = [
{ title:'Row 1', hasChild:true },
{ title:'Row 2', hasChild:true },
{ title:'Row 3', hasChild:true },
{ title:'Row 4', hasChild:true }
];
var tab = Titanium.UI.createTableView({
top:43,
data:Tab_data
});
tab.selectionIndicator=true;
tab.addEventListener('click',function(e) {
var ind = e.index;
if(e.selectRow)
{
Titanium.API.inof(' Selected clicked');
my_combo.value = e.selectRow.title;
}
});
1) Create the row and attach the rowid to it, or whatever other data you want to associate to a row.
var row = Ti.UI.createTableViewRow();
row.rowId = 1;
row.myText = "hello world";
2) Add click event listener to the table:
tableView.addEventListener('click', selectRow);
3) In selectRow function, get the data.
function selectRow(e) {
var rowId = e.rowData.rowId;
var myText = e.rowData.myText;
myTextField.value = myText;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With