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

iOS: TableView - implement deleteRow(TableViewRowProxy)

    Details

      Description

      Steps To Reproduce:
      1. Run test code below

      Ti.UI.backgroundColor = 'white';
      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' }));
      sectionFruit.addEventListener("click", function(){
          Ti.API.info("*************************** Clicked: " + sectionFruit.headerTitle);
      });
       
      var sectionVeg = Ti.UI.createTableViewSection({ headerTitle: 'Vegetables' });
      sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Carrots' }));
      sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Potatoes' }));
       
      var sectionFish = Ti.UI.createTableViewSection({ headerTitle: 'Fish' });
      sectionFish.add(Ti.UI.createTableViewRow({ title: 'Cod' }));
      sectionFish.add(Ti.UI.createTableViewRow({ title: 'Haddock' }));
      sectionFish.addEventListener("click", function(){
          Ti.API.info("*************************** Clicked: " + sectionFish.headerTitle);
      });
       
      var table = Ti.UI.createTableView({
        data: [sectionFruit, sectionVeg, sectionFish]
      });
      table.addEventListener("click", function(){
          Ti.API.info("*************************** Clicked: table");
      });
       
      win.add(table);
      win.open();
       
      var currentRows = [];
       
      var b1 = Ti.UI.createButton({
          bottom: 10,
          title: "remove Blue Row " + currentRows.length
      });
      b1.addEventListener("click", function(){
          var r = currentRows.pop();
          table.deleteRow(r);
          if (currentRows.length >= 1) {
              b1.title = "remove Blue Row " + (currentRows.length-1);
          }
      });
       
      var b2 = Ti.UI.createButton({
          bottom: 100,
          title: "insert Blue Row after index 0"
      });
      b2.addEventListener("click", function(){
          var r = Ti.UI.createTableViewRow({
              height:80,
              title:"Blue Row " + currentRows.length,
              color:'blue'
          });
          table.insertRowAfter(0, r);
          b1.title = "remove Blue Row " + currentRows.length;
          currentRows.push(r);
           
          r.addEventListener("click", function(){
              Ti.API.info("*************************** Clicked: " + r.title);
          });
      });
       
      var b3 = Ti.UI.createButton({
          bottom: 190,
          title: "append Blue Row"
      });
      b3.addEventListener("click", function(){
          var r = Ti.UI.createTableViewRow({
              height:80,
              title:"Blue Row " + currentRows.length,
              color:'blue'
          });
          table.appendRow(r);
          b1.title = "remove Blue Row " + currentRows.length;
          currentRows.push(r);
           
          r.addEventListener("click", function(){
              Ti.API.info("*************************** Clicked: " + r.title);
          });
      });
       
      win.add(b1);
      win.add(b2);
      win.add(b3);
      

      2. Click the buttons "append" or "insert" to add Blue Row to the table and then click the button "remove".
      Expected:
      The Blue Row is removed.
      Actual:
      The first row is removed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwang Ping Wang
                Reporter:
                pwang Ping Wang
              • Watchers:
                3 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 Source Code