I'm trying to get a table in Titanium where each row has a static text and a textField where I can input something.
So I go and create a row where it's left part is the static text and the right part it's my input text field. Just a small problem, I can't hide the keyboard by clicking outside of it.
If it was a normal textField outside a table I would just use the blur method, but in this case I can't get that to work.
This is my code so far: Any idea on how this works and if the solution is valid for both iOS and Android?
var winAddObjectView = Titanium.UI.currentWindow;
var tableAddObjectData = [
{title:'name', hintText:'item name (optional)'},
{title:'track no.', hintText:'object tracking code'}
];
var tableAddObjectRowData = [];
for (var i = 0; i < tableAddObjectData.length; i++) {
var title = Ti.UI.createLabel({
text:tableAddObjectData[i].title,
textAlign:"right",
left:"20",
height:'auto',
width:'68',
color:'#526691',
font:{fontSize:12, fontWeight:'bold'},
});
var textField = Ti.UI.createTextField({
hintText:tableAddObjectData[i].hintText,
textAlign:"left",
left:"96",
height:'auto',
width:'184',
color:'#4C4C4C',
font:{fontSize:12, fontWeight:'bold'},
});
winAddObjectView.addEventListener("click", function(e){
textField.blur();
});
var row = Ti.UI.createTableViewRow({
height:"45",
});
row.add(title);
row.add(textField);
tableAddObjectRowData.push(row);
}
var tableAddObjectView = Ti.UI.createTableView({
headerTitle:'Enter Tracking Information',
style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
backgroundColor:'transparent',
data:tableAddObjectRowData,
});
winAddObjectView.add(tableAddObjectView)