[TIMOB-16217] Android: Textfield loses focus and tableView scrolls to top when entering text into textfield and pickers are part of tableViewRows
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 3.2.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android, pickers, tableView, tableViewRow, textfield |
Reporter | Da'oud Rashid |
Assignee | Unknown |
Created | 2012-04-20T03:55:52.000+0000 |
Updated | 2018-02-28T20:04:09.000+0000 |
Description
When pickers are present in other tableViewRows, an attempt to enter text into a textField results in one character being entered into the field just before the textField loses focus and the tableView scrolls to its top.
Without pickers present in other rows, the behavior is as expected and the user can continue to enter text.
Sample code:
var win =Ti.UI.createWindow({backgroundColor:'#fff'});
var captions = [];
var fields = [];
var rows = [];
var pickerRows = [];
for (var i = 0, ii=20; i<ii; i++){
if(i%2==0){
fields[i] = Ti.UI.createTextField({
value:'field ' + i + ' contents',
width:200,
height:60,
rowIndex:i
});
} else {
fields[i] = Ti.UI.createPicker({
type: Titanium.UI.PICKER_TYPE_PLAIN,
selectionIndicator:true,
width:200
});
if(i%5 == 0){
fields[i].type = Titanium.UI.PICKER_TYPE_DATE;
} else {
for (var x = 0, xx = i; x<xx; x++){
pickerRows[x] = Ti.UI.createPickerRow({
title:'row ' + x,
value:x
});
}
fields[i].add(pickerRows);
}
}
captions[i] = Ti.UI.createLabel({
text:'This is caption ' + i,
width:200,
height:60
});
rows[i] = Ti.UI.createTableViewRow({layout:'vertical'});
rows[i].add(captions[i]);
rows[i].add(fields[i]);
}
var tableView = Ti.UI.createTableView(
{
data:rows
}
);
win.add(tableView);
win.open();
Hi Da'oud, Did the work-around solve your issue? Regards, Betty
Hi Betty, My apologies for the late reply. It's been a busy couple of weeks. Unfortunately, the work-around does not entirely solve the issue. Text fields are no longer losing focus on text-entry, but the containing table still scrolls to its top. I abandoned this approach and placed all my controls on a scroll view a while ago, but look forward to a fix. Again, apologies for the late reply. Kind regards, Da'oud
Hi Da'oud, I just noticed that you were using Titanium SDK 2.0.2.201204191742. I would recommend using the latest official release of the SDK (2.0.1GA2). Does the bug still occur when you build with 2.0.1GA2? I am unable to reproduce it. Regards, Betty
Closing due to age without a response. Unable to reproduce locally.
This Issue is still open. I have just tested with Ti SDK 3.1.0 and a TableView with say 10 TextFields. If you tap into one of the TextFields that is not the first 3, nor the last 3, the TableView scrolls out of view upwards
Moving this ticket to engineering as we can reproduce it with 3.2.0 release. It does not appear to be a duplicate of TIMOB-8332. Putting text fields in a table view row is not considered the best practice but we would let engineering decide the fate of this bug.