Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23639] Windows: Updating a tableviewsection with the index of a deleted tableviewsection adds the deleted tableviewsection back

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-07-18T01:23:22.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sRelease 6.0.0
ComponentsWindows
Labelsqe-5.4.0
ReporterEwan Harris
AssigneeGary Mathews
Created2016-07-14T17:15:25.000+0000
Updated2016-09-06T14:48:45.000+0000

Description

Description

When calling updateSection for a tableviewsection with the index number that once referenced a deleted section, it appears that the deleted section is updated and readded to the tableview. The code below does the following:

Create a tableview with two sections

When the window opens, delete the section at index 1 and append a new section

When a tableviewrow is clicked, update the section at index

On Android and iOS this code works as expected, with the title of the 2 section being updated
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 testSection = Ti.UI.createTableViewSection({ 
	headerTitle: 'Test'
});

var table = Ti.UI.createTableView({
	data: [sectionFruit, testSection]
});

win.addEventListener('open', function() {
	table.deleteSection(1);
	table.appendSection(createSection('newSection'));
	var sections = table.sections;
	for(var i = 0; i < sections.length; i++) {
		console.log(sections[i].headerTitle);
	}
});

table.addEventListener('click', function() {
	table.updateSection(1, createSection('updateSection'));
	var sections2 = table.sections;
	console.log(table.sections.length);
	for(var i = 0; i < sections2.length; i++){
		console.log(sections2[i].headerTitle);
	}
});

function createSection(title){
	return section = Ti.UI.createTableViewSection({ headerTitle: title});
}

win.add(table);
win.open();

Steps to reproduce

1. Using the code above, build for Windows Platform using appc run -p windows -T wp-emulator 2. Tap one of the rows in the first section

Actual result

There are now 3 sections Fruit, updateSection and newSection

Expected result

There should only be 2 sections Fruit and updateSection

Comments

  1. Gary Mathews 2016-07-15

  2. Ewan Harris 2016-09-06

    Verified using: OS: Microsoft Windows 10 Pro 10.0.14393 Appc core: 6.0.0-38 Appc NPM: 4.2.8-6 Ti SDK: 6.0.0.v20160904203840 Lumia 930: 10.0 Demo code in the description now works as expected Closing ticket

JSON Source