Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-15849

TableView event.index is wrong when TableView has sections (Mobile Web Only)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Won't Fix
    • Affects Version/s: Release 3.1.3, Release 3.2.0
    • Fix Version/s: None
    • Component/s: MobileWeb
    • Environment:

      OS: MAC OS X 10.8.5
      Ti SDK: 3.1.3 GA
      Ti CLI: 3.2.0
      Mobile Web

      Description

      Problem Description

      This bug exists only on mobile web, not on Android on iOS.

      Screenshot of browser and description of bug

      • If you click on "One", you'll see an alert for index 0, as expected.
      • If you click on "Three", you'll see an alert for index 1, as expected.
      • If you click on "Two", you'll see an alert for index 2, as expected.
      • If you click on "Four", you'll see an alert for index 2, *NOT AS EXPECTED*
      • And indeed, if you add more rows to the "Evens" section, they will all alert index 2.

      Also, the same problem occurs if I create the rows and sections using XML only.

      Test case

       win = Titanium.UI.createWindow({
      	backgroundColor : '#fff',
      	exitOnClose : true
      });
       
      var aTableView = Ti.UI.createTableView();
       
      var sections = [];
      sections.push(Ti.UI.createTableViewSection({
      	headerTitle : "Odds"
      }));
      sections[0].add(makeTableViewRow("One"));
      sections[0].add(makeTableViewRow("Three"));
      sections.push(Ti.UI.createTableViewSection({
      	headerTitle : "Evens"
      }));
      sections[1].add(makeTableViewRow("Two"));
      sections[1].add(makeTableViewRow("Four"));
      aTableView.setData(sections);
       
      function makeTableViewRow(rowText) {
      	return Ti.UI.createTableViewRow({
      		title : rowText,
      		className : "row"
      	});
      }
       
      aTableView.addEventListener('click', function(e) {
      	alert( e.index);
      });
       
      win.add(aTableView);
       
      win.open();
      
      

      Steps to reproduce

      1. Create a new project
      2. Paste test code in app.js
      3. Run on Mobile Web
      4. Click on 4th Row its alert 2 but actual result 3

        Attachments

          Activity

            People

            • Assignee:
              cbarber Chris Barber
              Reporter:
              jonahx Jonah G
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-17938
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code