Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2430] adding labels to tableviewrow dynmaically fails: redraw bug

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:05.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M07
ComponentsAndroid
Labelsandroid, dynamic, label, regression, release-1.6.0, tableview, tableviewrow
ReporterRobby
AssigneeDon Thorp
Created2011-04-15T03:19:31.000+0000
Updated2011-04-17T01:59:05.000+0000

Description

Similar to #2208, adding a label dynamically to a TableViewRow does not show up. One has to refresh the entire table (via setData([]); setData(tableRowData);) to see the added label.

Given both of these tickets, there is probably a problem with just about anything added to a tableview row dynamically showing up without a full refresh.

Code worked in 1.4.0. From #2208 seems like it was a 1.5.x regression.

Comments

  1. Don Thorp 2011-04-15

    Robby, please provide a quick sample if you're going to add tickets directly and also provide the information from the version.txt file in the build of the mobilesdk you're using.

  2. Robby 2011-04-15

    Hey Don,

    Here's the code example. This shows off this bug, as well as the one in #2208.
    Version.txt info of my 1.5 build: version=1.5.0 timestamp=11/24/10 04:54 githash=c0aff27
    This code works perfectly on this 1.4.2 build: version=1.4.2 timestamp=10/11/10 19:02 githash=425bc37

       Ti.API.info("@ win_test.js");
       var win = Ti.UI.currentWindow;
       win.backgroundColor = "#b5aea5";
       
       var displayName = Ti.UI.createLabel({
         top: 0,
         left: 0,
         font:{fontSize: 20, fontWeight:'bold'},
         height: 30,
         width: 320,
         color:'#000000',
         text:"Testing 123"
       });
       win.add(displayName);
       
       var rowData = [];
       for (var i = 0; i < 1; i++) {
         var row = Ti.UI.createTableViewRow({
           height: 50,
           title: "Row " + i,
           color: "#000000",
           backgroundColor:"#DDDDDD",
           className: 'rowbla'
         });
         rowData.push(row);
       }
       
       var tableView = Ti.UI.createTableView({
         top:displayName.top + displayName.height + 10,
         data: rowData
       });
       win.add(tableView);
       
       win.addEventListener('focus', function(e) {
         setTimeout(changeColors, 2000);
       });
       
       function changeColors() {
         //dynamic bg color change of label
         //this always works
         displayName.backgroundColor = "#0000FF";
         
         //dynamic bg color change of row 1
         //this never works (it sometimes work if we do it on the window focus event, never if we do it on delay)
         rowData[0].backgroundColor = "#0000FF";
         
         //dynamic add label to row 2
         //this never works (it sometimes work if we do it on the window focus event, never if we do it on delay)
         var newLabel = Ti.UI.createLabel({
           top: 5,
           left: 5,
           font:{fontSize: 20, fontWeight:'bold'},
           height: 'auto',
           width: 'auto',
           color:'#00FF00',
           text:"NEW LABEL BLA"
         });
         rowData[0].add(newLabel);
       }
       
  3. Marshall Culpepper 2011-04-15

    (from [8aa0ef980e344bddcf4e5f60eda9e43a0a14cd17]) update a TableViewRow's view when a child is added or removed [#2430 state:fixed-in-qa] https://github.com/appcelerator/titanium_mobile/commit/8aa0ef980e344bddcf4e5f60eda9e43a0a14cd17"> https://github.com/appcelerator/titanium_mobile/commit/8aa0ef980e34...

  4. Opie Cyrus 2011-04-15

    verified with test case from Robby

JSON Source