I have a table View with sections and rows, after the UI has been rendered I wanna delete some sections and rows.
But when I call the function deleteRow after I called function deleteSection, the View stopped to be rendered and no other operation is possible on tableview.
I can call either deleteSection or deleteRow calling both in a row raise this issue.
var win = Ti.UI.createWindow({title:"Click Edit ->"});
var data = [];
var navWin = Titanium.UI.iOS.createNavigationWindow({
window: win
});
var tableViewSectionOne = Ti.UI.createTableViewSection();
var tableViewSectionTwo = Ti.UI.createTableViewSection();
var tableViewSectionThree = Ti.UI.createTableViewSection();
var tableViewSectionFour = Ti.UI.createTableViewSection();
var tableView = Ti.UI.createTableView({
backgroundColor:'#FFF',
rowHeight: 100,
zIndex:1
});
var deleteSection = Ti.UI.createButton({
systemButton: Titanium.UI.iPhone.SystemButton.EDIT,
});
var dataSectionOne = [
Ti.UI.createTableViewRow({title:"Click a row to remove",color:'#A00',height:50}),
Ti.UI.createTableViewRow({title:"Click Editbutton to remove a section and noting will work",color:'#C00',height:50}),
Ti.UI.createTableViewRow({title:"Row 3",color:'#F00',height:50})
];
var dataSectionTwo = [
Ti.UI.createTableViewRow({title:"Row 4",color:'#0A0',height:50}),
Ti.UI.createTableViewRow({title:"Row 5",color:'#0B0',height:50}),
Ti.UI.createTableViewRow({title:"Row 6",color:'#0F0',height:50})
];
var dataSectionThree = [
Ti.UI.createTableViewRow({title:"Row 7",color:'#00A',height:50}),
Ti.UI.createTableViewRow({title:"Row 8",color:'#00B',height:50}),
Ti.UI.createTableViewRow({title:"Row 9",color:'#00F',height:50})
];
var dataSectionFour = [
Ti.UI.createTableViewRow({title:"Row 10",color:'#E00',height:50}),
Ti.UI.createTableViewRow({title:"Row 11",color:'#C00',height:50}),
Ti.UI.createTableViewRow({title:"Row 12",color:'#B00',height:50})
];
data.push(tableViewSectionOne);
for(var i in dataSectionOne){
tableViewSectionOne.add(dataSectionOne[i]);
}
data.push(tableViewSectionTwo);
for(var i in dataSectionTwo){
tableViewSectionTwo.add(dataSectionTwo[i]);
}
data.push(tableViewSectionThree);
for(var i in dataSectionThree){
tableViewSectionThree.add(dataSectionThree[i]);
}
data.push(tableViewSectionFour);
for(var i in dataSectionFour){
tableViewSectionFour.add(dataSectionFour[i]);
}
tableView.setData(data);
deleteSection.addEventListener('click', function(){
tableView.deleteSection(0);
});
win.rightNavButton = deleteSection;
tableView.addEventListener('click', function(e){
tableView.deleteRow(e.source);
});
win.add(tableView);
navWin.open();
Hi, We have tested this issue with given test code and it's working good as we expected.
Test Environment
Mac OS X 10.9.4 Ti CLI 3.3.0 Titanium SDK: 3.3.0.GA IOS 7.1 Thanks.Fixed in 3.3.0.GA