Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3014] CreateTableView Style

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2012-06-01T08:17:57.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterBrandon Fuller
AssigneeEduardo Gomez
Created2012-04-20T18:29:37.000+0000
Updated2016-03-08T07:48:02.000+0000

Description

I was stuck on this weird behavior today where my table view would not show the iOS pinstrip background behind my tableview on the 2nd and most after that views. It always showed on the first. Here was my code:
var tableview = Titanium.UI.createTableView({
	data: data
});

if (isApple())
{
	tableview.style = Titanium.UI.iPhone.TableViewStyle.GROUPED;
}
Through trial and error I found out that this worked properly:
if (isApple())
{
	var tableview = Titanium.UI.createTableView({
		data: data
		style: Titanium.UI.iPhone.TableViewStyle.GROUPED;
	});
}
else
{
	var tableview = Titanium.UI.createTableView({
		data: data
	});	
}
So why does it matter if I set the property in the create or after?

Comments

  1. Devang Gandhi 2012-04-30

    Can you provide the SDK version?
  2. Brandon Fuller 2012-04-30

    2.0.1.GA2
  3. Devang Gandhi 2012-05-09

    See this sample it works:
    var win = Ti.UI.createWindow({
         backgroundColor: 'white',
         
         title: 'TableView Demo'
       });
       
       var data = [];
       
       for (var c=0;c<4;c++)
       {
       	data[c] = Ti.UI.createTableViewSection({headerTitle:'Group '+(c+1)});
       	for (var x=0;x<10;x++)
       	{
       		data[c].add(Ti.UI.createTableViewRow({title:'Group '+(c+1)+', Row '+(x+1)}));
       	}
       }
       
       // create table view
       var tableview = Titanium.UI.createTableView({
       	data:data,
       	
       });
       
       tableview.style = Titanium.UI.iPhone.TableViewStyle.PLAIN;
       
       
       win.add(tableview);
       
       win.open();
       
  4. Eduardo Gomez 2012-06-01

    Setting _style_ worked both ways (at instantiation or through property).
       // create table view
       var tableview = Titanium.UI.createTableView({
           data:data,
           style : Titanium.UI.iPhone.TableViewStyle.GROUPED
       });
        
       //tableview.style = Titanium.UI.iPhone.TableViewStyle.GROUPED;
       

    Tested on

    Titanium SDK 2.0.1.GA2 iOS 5 Simulator

JSON Source