Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9944] iOS: Scroll click event hanging over in event firing for iOS tableview

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-12-21T05:28:52.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-16 API, Release 3.0.0
ComponentsiOS
Labelsapi, community, module_tableview, qe-review, qe-testadded
ReporterNeville Dastur
AssigneeVishal Duggal
Created2012-07-05T09:08:17.000+0000
Updated2013-04-17T18:19:26.000+0000

Description

/*
 * A simple project based on Single Window Application Template:
 * to test minimal cases
 */

//bootstrap and check dependencies
if (Ti.version < 1.8 ) {
	alert('Sorry - this application template requires Titanium Mobile SDK 1.8 or later');	  	
}

// This is a single context application with mutliple windows in a stack
(function() {	
	var self = Titanium.UI.createWindow({
        title: 'Window',
        backgroundColor: 'white',
        });    


    var row;
    var data = [];
        
    for(i=0;i<10;i++) {
            var l = Ti.UI.createLabel({text: "Test row " + i, left: '10dp', right: '30dp' });
            var r = Ti.UI.createTableViewRow({rownumber: i, hasCheck: false, backgroundColor: '#eeeeee', className: 'datarow'});
            r.add(l);
            data.push(r);
    }
        
    var tv = Ti.UI.createTableView({
            data: data,
            backgroundColor: 'transparent',
            style: Ti.UI.iPhone.TableViewStyle.GROUPED,
            minRowHeight: '52dp',
            top: '30dp', bottom: '60dp'
    });

    tv.addEventListener('click', function(e){
        Ti.API.info("Row number " + e.row.rownumber + " clicked");
        e.row.hasCheck = !e.row.hasCheck;
    });
    
    self.add(tv);
    self.open();
})();
Run the above code Click row 1 Scroll up "using row 6" so that row 1 disappears from view and 2 is top Click row 4 A check will appear in row 6 and event will fire saying row 6 clicked

Comments

  1. Neville Dastur 2012-07-05

    I would really appreciate some sort of patch for this ASAP. It effects a medical app we have out and essentially this bug results in a mis-calculation of a score. Thanks
  2. Neville Dastur 2012-07-10

    A further test case that causes problems is the addition of layout vertical to the containing window. In the example below commenting out the top and bottom values "fixes" the problem un-commneting the
    //layout: 'vertical'
    will cause the same issue despite the top and bottom remaining commented out
       (function() {	
       	var self = Titanium.UI.createWindow({
               title: 'Window',
               backgroundColor: 'white',
               //layout: 'vertical'
               });    
       
       
           var row;
           var data = [];
               
           for(i=0;i<10;i++) {
                   var l = Ti.UI.createLabel({text: "Test row " + i, left: '10dp', right: '30dp' });
                   var r = Ti.UI.createTableViewRow({rownumber: i, hasCheck: false, backgroundColor: '#eeeeee', className: 'datarow'});
                   r.add(l);
                   data.push(r);
           }
               
           var tv = Ti.UI.createTableView({
                   data: data,
                   backgroundColor: 'transparent',
                   style: Ti.UI.iPhone.TableViewStyle.GROUPED,
                   minRowHeight: '52dp',
                   //top: '30dp', bottom: '60dp'
           });
       
           tv.addEventListener('click', function(e){
               Ti.API.info("Row number " + e.row.rownumber + " clicked");
               e.row.hasCheck = !e.row.hasCheck;
           });
           
           self.add(tv);
           self.open();
       })();
       
  3. Varun Joshi 2012-07-11

    Hi Neville, Could you please provide info about the Ti SDK that you are using? Does this issue also occur in 2.1.0.GA (if you are not using it) or the latest CI build?
  4. Neville Dastur 2012-07-11

    Sorry, yes it was on 2.1.0 GA, but I also tested on 2.0.1 and occurs in that too. Haven't tried 1.8.x
  5. Neville Dastur 2012-07-20

    Sorry, is there any news on this. It's a pretty serious bug. More than medium I would suggest.
  6. Blain Hamon 2012-07-31

    For some reason, I am still having issues trying to recreate this, even in 2.1. Is there any hints or technique in triggering this?
  7. Neville Dastur 2012-07-31

    That is odd. It issue occurs very consistently for me. Certainly on the iPhone simulator. I'll try again on the iPad hardware. Does that mean when you follow the steps above, it doesn't occur for you?
  8. Vishal Duggal 2012-08-07

    Tested on IOS Sim (4.3, 5.0, 5.1), iPAD3 (5.1.1) and iPod touch (4.3.5) with 2.1.1 GA and current master. Can not reproduce the issue with either of the attached test cases.
  9. Neville Dastur 2012-08-07

    I still get this issue. I have just re-built using SDK 2.1.1 GA on OSX 10.6 IOS Sim 5.0 Here is the video http://www.youtube.com/watch?v=AtpqJLQFV4c And using this code. Different to above as was trying to narrow down further.
       (function() {
       	var self = Titanium.UI.createWindow({
               title: 'Window',
               backgroundColor: 'white',
               });    
       
       
           var row;
           var data = [];
               
           for(i=0;i<10;i++) {
                   var l = Ti.UI.createLabel({text: "Test row " + i, left: '10dp', right: '30dp' });
                   var r = Ti.UI.createTableViewRow({
                     height: 55, rownumber: i, hasCheck: false, backgroundColor: '#eeeeee', className: 'datarow'});
                   r.add(l);
                   data.push(r);
           }
               
           var tv = Ti.UI.createTableView({
                   data: data,
                   backgroundColor: 'transparent',
                   height: 'auto'
           });
       
           tv.addEventListener('click', function(e){
               Ti.API.info("Row number " + e.row.rownumber + " clicked");
               e.row.hasCheck = !e.row.hasCheck;
           });
           
           self.add(tv);
           self.open();
       })();
       
  10. Vishal Duggal 2012-08-08

    Thanks for the video. Seems to be a valid issue
  11. Vishal Duggal 2012-08-08

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/2698
  12. Blain Hamon 2012-08-10

    Pull merged.
  13. Olga Romero 2012-08-14

    Verified fix with: Titanium Studio, build: 2.1.1.201207271312 Titanium SDK: 2.2.0.v20120813184911 Devices: iPhone 4s 5.0.1 iPad1 5.1.1 Simulator 5.1 Note:in Console [INFO] Row number # clicked reflects # of Row actually clicked:)
  14. Shyam Bhadauria 2012-09-06

    Re-opening to edit label
  15. Neville Dastur 2012-11-24

    Nice to see a fix, but months after PR still not in released SDKs. Is there a reason for the delay? Thanks

JSON Source