Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20448] Android: Adding text color to a singular row adds the color to multiple down the list

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-02-27T01:54:32.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsqe-6.1.0
ReporterJosh Longton
AssigneeFrankie Merzadyan
Created2016-02-23T23:44:36.000+0000
Updated2017-05-31T22:29:38.000+0000

Description

Adding text color to a singular row adds the color to multiple down the list. *Steps to reproduce:*

Use the app.js file below.

*Actual :* Multiple rows have red text and it keeps changing. *Expected:* Only the first row should have red text *App.js*
var win = Ti.UI.createWindow({
    backgroundColor: 'black',
});
var array = [];

for (var i = 0; i < 501; i++) {
	var obj = {
    title : "Row "+ i        
   };
  if (i == 0) { 
  	obj.color = 'red';
  }
      array.push(obj);
}

var tableview = Titanium.UI.createTableView({
    data: array,
});

win.add(tableview);
win.open();

Comments

  1. Malcolm Hollingsworth 2016-02-24

    Not a bug. This is you not understanding how JavaScript works. Take a look at the **addRow** function in the comments section. It shows the concept of encapsulates the changes to a row inside a function. [https://ti-qa-archive.github.io/question/152853/html-tag-in-a-row] I add this to give you a push to solve your own problem, I am not going to give you tech support though. But in essence the idea is create a function to deal with a single instance of each row and return the result - then push that results into your array. You do NOT need to change all your code to match my example.
  2. Ivan Skugor 2016-02-24

    There's nothing wrong with JS code there, it's Titanium bug (if it hasn't dropped passing JS object as table view row, which I think it has not ... yet).
  3. Eric Merriman 2016-02-25

    Hello [~core13] This is a titanium bug. This ticket was written by our Appcelerator QE intern Josh, and was evaluated by a Senior Quality Engineer and our Senior QE manager prior to submission (which is how we train our interns). Regardless of the code used, be it yours, the attached example, or a more simple manual creation of the tableview rows we get the same bad behavior. Perhaps you might consider more carefully the tone of your comments, because to me, your recent comment seems a bit demeaning. Here is another sample that shows the same behavior:
       var win = Ti.UI.createWindow({
           backgroundColor: 'black',
       });
       var array = [
                       {
                       title : "Red row",
                       color : "red"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       },{
                       title : "Row"    
                       }
       
       
       ];
       
       var tableview = Titanium.UI.createTableView({
           data: array,
       });
       
       win.add(tableview);
       win.open();
       
  4. Hans Knöchel 2016-11-16

    This is no 6.0.0 regression right? Moving it to 6.1.0 for now.
  5. Frankie Merzadyan 2017-02-23

    master: https://github.com/appcelerator/titanium_mobile/pull/8848
  6. Josh Longton 2017-03-07

    {noformat} Mac OS Version : 10.12.3 Appc CLI : 6.1.0 Appc NPM : 4.2.9-1 Node : v4.6.0 Device: Nexus 5x(6.0.1) Pixel XL(7.1.1) Emulator: (6.0), (4.4.2) {noformat} Using above env passed FR. After merge, the changes are present in SDK 6.1.0.v20170227120704. *Closing*

JSON Source