{ "id": "62370", "key": "TIMOB-1738", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11240", "name": "Release 1.6.0 M07", "archived": true, "released": true, "releaseDate": "2011-01-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:57:01.000+0000", "created": "2011-04-15T03:00:56.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "apple", "bug", "defect", "ios", "ipad", "release-1.6.0", "tableview" ], "versions": [], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:57:01.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

On 3.2 the grouped table view does not honor background color\nproperty. The Rows will change color but the background around the\nview always stays gray.

\n

var win = Ti.UI.currentWindow;
\nwin.backgroundColor = '#FFF';

\n

var data = [];

\n

for (var c=0;c<4;c++)
\n{

\n
\ndata[c] = Ti.UI.createTableViewSection({headerTitle:'Group '+(c+1)});\nfor (var x=0;x<10;x++)\n{\n    data[c].add(Ti.UI.createTableViewRow({title:'Group '+(c+1)+', Row '+(x+1),backgroundColor:'#FF0000'}));\n}\n
\n

}

\n

// create table view var tableview =\nTitanium.UI.createTableView({

\n
\ndata:data,\nstyle: Titanium.UI.iPhone.TableViewStyle.GROUPED,\nbackgroundColor:'transparent'\n
\n

});

\n

// create table view event listener\ntableview.addEventListener('click', function(e)
\n{

\n
\n// event data\nvar index = e.index;\nvar section = e.section;\nvar row = e.row;\nvar rowdata = e.rowData;\nif (section.headerTitle.indexOf('clicked')==-1)\n{\n    section.headerTitle = section.headerTitle + ' (clicked)';\n}\nTitanium.UI.createAlertDialog({title:'Table View',message:'row ' + row + ' index ' + index + ' section ' + section  + ' row data ' + rowdata}).show();\n
\n

});

\n

// add table view to the window\nTitanium.UI.currentWindow.add(tableview);

{html}", "attachment": [], "flagged": false, "summary": "Grouped Table does not honor background color of the table view", "creator": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "126504", "author": { "name": "adriano", "key": "adriano", "displayName": "Adriano Paladini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I found a solution to make the 'backgroundColor' works in\nTableViewStyle.GROUPED.
\nThis solution will set the tableview default backgroundColor to\n'transparent', and will correct ANY color applied to it.

\n

I Tested this with successful in 1.4.2 and 1.5.0

\n

If you want correct only for your project:

\n\n

If you want correct all projects:

\n\n

Find these lines:

\n
\n\n    tableview.backgroundColor = style == UITableViewStylePlain ? [UIColor whiteColor] : [UIColor groupTableViewBackgroundColor];\n    tableview.opaque = YES;\n
\n

and change to this code:

\n
\n\n    //tableview.backgroundColor = style == UITableViewStylePlain ? [UIColor whiteColor] : [UIColor groupTableViewBackgroundColor];\n    //tableview.opaque = YES;\n\n    // CORRECTION FOR TRANSPARENT TABLEVIEW\n    if (style != UITableViewStylePlain)\n    {\n        UIView *myBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height)];\n        id BgColor = [self valueForKey:@\"backgroundColor\"];\n        if (BgColor!=nil)\n        {\n            myBackgroundView.backgroundColor = [Webcolor webColorNamed:BgColor];\n        }\n        else\n        {\n            myBackgroundView.backgroundColor = [UIColor clearColor];\n        }\n        tableview.backgroundView = myBackgroundView;\n    }\n    // CORRECTION FOR TRANSPARENT TABLEVIEW\n
{html}", "updateAuthor": { "name": "adriano", "key": "adriano", "displayName": "Adriano Paladini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:57.000+0000", "updated": "2011-04-15T03:00:57.000+0000" }, { "id": "126505", "author": { "name": "jamesk", "key": "jamesk", "displayName": "James K", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Adriano, does that introduce a memory leak? I see an alloc\nwithout a release.

{html}", "updateAuthor": { "name": "jamesk", "key": "jamesk", "displayName": "James K", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:57.000+0000", "updated": "2011-04-15T03:00:57.000+0000" }, { "id": "126506", "author": { "name": "adriano", "key": "adriano", "displayName": "Adriano Paladini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Ops, sorry James K, you right!

\n

chage this:

\n
\nUIView *myBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height)];\n
\n

to this:

\n
\nUIView *myBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height) autorelease];\n
\n

Sorry for that!

{html}", "updateAuthor": { "name": "adriano", "key": "adriano", "displayName": "Adriano Paladini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:57.000+0000", "updated": "2011-04-15T03:00:57.000+0000" }, { "id": "126507", "author": { "name": "adriano", "key": "adriano", "displayName": "Adriano Paladini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

SORRY again.....

\n

i forgot the brackets....

\n

Correct (and tested) code:

\n
\n\n        //tableview.backgroundColor = style == UITableViewStylePlain ? [UIColor whiteColor] : [UIColor groupTableViewBackgroundColor];\n        //tableview.opaque = YES;\n        \n        // CORRECTION FOR TRANSPARENT TABLEVIEW\n        if (style != UITableViewStylePlain)\n        {\n            UIView *myBackgroundView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height)] autorelease];\n            id BgColor = [self valueForKey:@\"backgroundColor\"];\n            if (BgColor!=nil)\n            {\n                myBackgroundView.backgroundColor = [Webcolor webColorNamed:BgColor];\n            }\n            else\n            {\n                myBackgroundView.backgroundColor = [UIColor clearColor];\n            }\n            tableview.backgroundView = myBackgroundView;\n        }\n        // CORRECTION FOR TRANSPARENT TABLEVIEW\n
{html}", "updateAuthor": { "name": "adriano", "key": "adriano", "displayName": "Adriano Paladini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:57.000+0000", "updated": "2011-04-15T03:00:57.000+0000" }, { "id": "126508", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [1b85b06736303aede99672606c5e72319a2ff8dc])\n[#1738 state:fixed-in-qa] Respect tableview BG\ncolor on creation, and only opaque out if not clear. \nhttps://github.com/appcelerator/titanium_mobile/commit/1b85b0673630...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:58.000+0000", "updated": "2011-04-15T03:00:58.000+0000" }, { "id": "126509", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested this code on iPad simulator and iPad, iOS 4.2

\n
\nvar win = Ti.UI.createWindow({backgroundColor:'green'});\nvar data = [];\nfor(var i=0;i<10;i++){\n    data[i] = Ti.UI.createTableViewRow({title:'Row #'+i});\n}\nvar tableview = Ti.UI.createTableView({\n    data:data,\n    style:Titanium.UI.iPhone.TableViewStyle.GROUPED,\n    backgrounColor:'#5A9ECF'\n});\nwin.add(tableview);\nwin.open();\n
\n

Problem persists.

\n

Ti. SDK 1.6 (Jan 25 2011 17:39 r1ead074f)

{html}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:58.000+0000", "updated": "2011-04-15T03:00:58.000+0000" }, { "id": "126510", "author": { "name": "adriano", "key": "adriano", "displayName": "Adriano Paladini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

In this new version made the correction as follows:

\n

after this line:

\n
\ntableview.opaque = ![tableview.backgroundColor isEqual:[UIColor clearColor]];\n
\n

I added:

\n
\n// CORRECTION FOR TRANSPARENT/COLOR BACKGROUND IN TABLEVIEW ON IPAD\nif(style != UITableViewStylePlain  && [TiUtils isIPad])\n{\n    UIView *myBackgroundView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, [self bounds].size.height)] autorelease];\n    myBackgroundView.backgroundColor = bgColor != nil ? bgColor : [UIColor clearColor];\n    tableview.backgroundView = myBackgroundView;\n}\n// CORRECTION FOR TRANSPARENT/COLOR BACKGROUND IN TABLEVIEW ON IPAD\n
{html}", "updateAuthor": { "name": "adriano", "key": "adriano", "displayName": "Adriano Paladini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:58.000+0000", "updated": "2011-04-15T03:00:58.000+0000" }, { "id": "126511", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Example provided works as expected when\nbackgroundColor doesn't contain a typo:

\n
\nvar win = Ti.UI.createWindow({backgroundColor:'green'});\nvar data = [];\nfor(var i=0;i<10;i++){\n    data[i] = Ti.UI.createTableViewRow({title:'Row #'+i});\n}\nvar tableview = Ti.UI.createTableView({\n    data:data,\n    style:Titanium.UI.iPhone.TableViewStyle.GROUPED,\n    backgroundColor:'#5A9ECF'\n});\nwin.add(tableview);\nwin.open();\n
\n

If table rows adopting table background color/using UIClearColor\nis considered a bug and NOT expected behavior (i.e. this is not\nwhat Android does), that is a separate bug and\nthis ticket should not be reopened.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:59.000+0000", "updated": "2011-04-15T03:00:59.000+0000" }, { "id": "126512", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

Stephen,
\nDon't know if I'm testing this the wrong way, but I can't change\nthe background of the tableview itself. This is the new code

\n
\nvar win = Ti.UI.createWindow({backgroundColor:'green'});\nvar data = [];\nfor(var i=0;i<10;i++){\n    data[i] = Ti.UI.createTableViewRow({title:'Row #'+i,backgroundColor:'yellow'});\n}\nvar tableview = Ti.UI.createTableView({\n    data:data,\n    style:Titanium.UI.iPhone.TableViewStyle.GROUPED,\n    backgroundColor:'#000'\n});\nwin.add(tableview);\nwin.open();\n
\n

I'm setting the background of the tableView black and the rows\nyellow. The background of the tableView does not change, even if I\nremove the background color of the rows.

\n

And sorry for the typo, oops.

\n

Ti SDK 1.6 (Jan 26 2011 14:27 r6342c788)
\nTiDev 1.2 and 1.3
\niPad Simulator 4.2

{html}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:59.000+0000", "updated": "2011-04-15T03:00:59.000+0000" }, { "id": "126513", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

OK, this works on iPhone (what I fixed the bug for) but not\niPad. Reopening.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:59.000+0000", "updated": "2011-04-15T03:00:59.000+0000" }, { "id": "126514", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [5cc2ed4bdf5fcd57edfd6c86d0e3201bfb1d5997])\n[#1738 state:fixed-in-qa] Fixed for iPad as well\n- there's an iPad-specific apple bug that screws up tableview\nbackground colors. Probably also affects BG images. \nhttps://github.com/appcelerator/titanium_mobile/commit/5cc2ed4bdf5f...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:00:59.000+0000", "updated": "2011-04-15T03:00:59.000+0000" }, { "id": "126515", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Confirmed that this is an apple bug. It's less than ideal, but\nI've added in the proposed solution of just outright replacing the\nbackground view in the case of iPad.

\n

Radar bug # is 8921858.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:01:00.000+0000", "updated": "2011-04-15T03:01:00.000+0000" }, { "id": "126516", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

Yes!

\n

Now it works as expected.

\n

Ti. SDK 1.6 (Jan 26 2011 16:47 rb481fe0b)
\niPad Simulator 4.2
\nTi. Dev. 1.3

{html}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:01:00.000+0000", "updated": "2011-04-15T03:01:00.000+0000" }, { "id": "126517", "author": { "name": "markoperutovic", "key": "markoperutovic", "displayName": "Marko Perutovic", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Border color is transparent

{html}", "updateAuthor": { "name": "markoperutovic", "key": "markoperutovic", "displayName": "Marko Perutovic", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:01:00.000+0000", "updated": "2011-04-15T03:01:00.000+0000" }, { "id": "126518", "author": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "body": "{html}

I just tested what Marko is referring. Only on iPad a grouped\nview's border is semi-transparent. Workaround is to explicitly set\nthe separatorColor to the tableView object.

\n

He's attached two images here to give an example: http://developer.appcelerator.com/helpdesk/view/66191#c324451

{html}", "updateAuthor": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "created": "2011-04-15T03:01:01.000+0000", "updated": "2011-04-15T03:01:01.000+0000" } ], "maxResults": 15, "total": 15, "startAt": 0 } } }