Problem description
tableView 'scroll' event is triggered also when just opening the tableView, clicking on a row or opening the keyboard.
Steps to reproduce
- Create a tableView and set an event listener associated to the 'scroll' event
Result: function is called when opening the window, clicking on a row in the tableView and other events not relative to scroll (see code sample - also when clicking on a textField and opening the keyboard)
Same code works as expected on iOS.
var win = Ti.UI.createWindow({
title:'pippo',
backgroundColor:'gray'
});
var search = Titanium.UI.createTextField({
// color:'#336699',
top:5,
width:400,
left:10,
hintText:'Search for ...',
borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED, keyboardType:Titanium.UI.KEYBOARD_DEFAULT, returnKeyType:Titanium.UI.RETURNKEY_DEFAULT
});
win.add(search);
var data = [];
var autocomplete_table = Titanium.UI.createTableView({
scrollable: true,
top: 170,
bottom:0,
backgroundColor:'white',
data:data
});
var row = Ti.UI.createTableViewRow({
title:'test'
});
data.push(row);
var autocomplete_table = Titanium.UI.createTableView({
scrollable: true,
top: 170,
bottom:0,
backgroundColor:'white',
data:data
});
win.add(autocomplete_table);
autocomplete_table.addEventListener('scroll', function(e) {
search.blur();
alert('triggered!')
});
win.open();
Additional notes
Customer ticket associated:
http://support-admin.appcelerator.com/display/APP-613444
Test code
Pull pending https://github.com/appcelerator/titanium_mobile/pull/2052
Titanium Studio: 2.1.0.201206221045 & 2.0.2 Mobile SDK: 2.1.0.v20120622174154 OS: X Lion Device: Samsung Galaxy Can't reproduce. Scroll event get fired only by scrolling, tap on text area or on rows doen't fired scrolling event.
Reopening to update labels.
Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5003