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

Android: index in TableView click event is no longer unique

    Details

    • Story Points:
      3
    • Sprint:
      2021 Sprint 5, 2021 Sprint 6, 2021 Sprint 10

      Description

      Description

      The index property in a click event of a TableView is no longer unique within the tableview, it's not per TableViewSection

      var win = Ti.UI.createWindow();
       
      var sectionFruit = Ti.UI.createTableViewSection({ headerTitle: 'Fruit' });
      sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Apples' }));
      sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Bananas' }));
       
      var sectionVeg = Ti.UI.createTableViewSection({ headerTitle: 'Vegetables' });
      sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Carrots' }));
      sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Potatoes' }));
       
      var table = Ti.UI.createTableView({
        data: [sectionFruit, sectionVeg]
      });
       
      win.add(table);
      win.open();
       
      table.addEventListener('click', function(e){
      	Ti.API.info('click listener:::::::::::'+JSON.stringify(e.index));
      });
       
      var sectionFish = Ti.UI.createTableViewSection({ headerTitle: 'Fish' });
      sectionFish.add(Ti.UI.createTableViewRow({ title: 'Cod' }));
      sectionFish.add(Ti.UI.createTableViewRow({ title: 'Haddock' }));
       
      table.insertSectionBefore(0, sectionFish);
      

      Steps to reproduce

      1. Add the code above to an existing app.js and build for Android
      2. Click Cod and click Apple

      Actual

      The index logged is the same (0)

      Expected

      The index logged should not be the same, (0 and 2 respectively)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                eharris Ewan Harris
                Reviewer:
                Joshua Quick
                Tester:
                Lokesh Choudhary
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration