Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11683] iOS: TableView - implement deleteRow(TableViewRowProxy)

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-11-20T18:00:14.000+0000
Affected Version/sRelease 2.1.3
Fix Version/sRelease 3.1.0, 2012 Sprint 23 API, 2012 Sprint 23
ComponentsiOS
Labelsapi, module_tableview, parity, qe-testadded
ReporterPing Wang
AssigneePing Wang
Created2012-11-07T01:38:22.000+0000
Updated2014-06-19T12:43:51.000+0000

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.

Comments

  1. Vishal Duggal 2012-11-07

    Marking this as a new feature since iOS has never supported deleting row by row proxy. No idea how QE got the idea.
  2. Ping Wang 2012-11-07

    PR: https://github.com/appcelerator/titanium_mobile/pull/3388
  3. Shyam Bhadauria 2013-03-06

    Its working fine on iOS as well as android. Environment used for verification - Titanium SDK: 3.1.0.v20130305190758 Titanium  Studio:3.0.2.201302141201 Device: iOS simulator 6.0 (and Samsung GALAXY Note Android 2.3.6)

JSON Source