Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2146] Android: setData not always updating

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:58:13.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
ComponentsAndroid
Labelsandroid, defect
ReporterDon Thorp
AssigneeBill Dawson
Created2011-04-15T03:11:49.000+0000
Updated2011-04-17T01:58:13.000+0000

Description

See http://developer.appcelerator.com/helpdesk/view/50231">Helpdesk 50231 for example.

Not marking as a regression yet. Bill if you think it is, please tag it that way.

Comments

  1. Bill Dawson 2011-04-15

    Workaround is to set to empty array then set to real data.

  2. Bill Dawson 2011-04-15

    confirmed this is already fixed in 1.5. My test:

       
       var win = Ti.UI.currentWindow;
       var data = [];
       for (var i = 0; i < 8; i++) {
           data.push(
               Ti.UI.createTableViewRow({ title: 'Row ' + (i + 1), color: 'black', backgroundColor: 'yellow'})
           );
       }
       
       var tv = Ti.UI.createTableView({
           top: 40, data: data
       });
       
       win.add(tv);
       
       var btn = Ti.UI.createButton({
           title: 'setData()',
           top: 0,
           left: 0,
           width: 150,
           height: 35
       });
       
       btn.addEventListener('click', function() {
           data.push( Ti.UI.createTableViewRow({ title: 'Another row', color: 'black', backgroundColor: 'white'}));
           tv.setData(data);
       });
       
       win.add(btn);
       
  3. Bill Dawson 2011-04-15

    (from [536e81c80f9fef69c2681fde27f74b029b75a79c]) [#2146] Add unit test to be sure setData successfully replaces existing data rows. https://github.com/appcelerator/titanium_mobile/commit/536e81c80f9fef69c2681fde27f74b029b75a79c"> https://github.com/appcelerator/titanium_mobile/commit/536e81c80f9f...

JSON Source