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

Windows: Updating a tableviewsection with the index of a deleted tableviewsection adds the deleted tableviewsection back

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 5.4.0
    • Fix Version/s: Release 6.0.0
    • Component/s: Windows
    • Labels:
    • Environment:

      Windows 10 Pro
      Appc CLI Core: 5.4.0-33
      Appc CLI NPM: 4.2.7
      Ti SDK: 5.4.0.v20160713141635
      Appc Studio: 4.7.0.201607111053

    • Story Points:
      5
    • Sprint:
      2016 Sprint 15 SDK

      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:

      1. Create a tableview with two sections
      2. When the window opens, delete the section at index 1 and append a new section
      3. 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

        Attachments

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              eharris Ewan Harris
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-9918
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code