Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12872] iOS: adding same rows array to multiple tables results in layout issues if rows contain other view like image etc.

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsappendrow, imageView, rows, setdata, tableView
ReporterCarter Lathrop
AssigneeUnknown
Created2013-02-21T09:35:20.000+0000
Updated2018-02-28T20:03:49.000+0000

Description

My project requirements were to create multiple views, each containing a table. The first view contains all the data from all tables and other views contain their specific data only.*If you add another view to a row, the whole view appears only in one table and completely disappears in second table*. Below is the code for sample project i made, note that the properties icon is not visible in second view even when the data is same. *app.js*
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

var self=Ti.UI.createWindow({
	top:0,
	left:0,
	right:0,
	bottom:0,
	backgroundColor: "#525252",
	modal: true,
	title: "Demo Tables"
})

var closeBtn= Ti.UI.createButton({
	title: "Back"
});
closeBtn.addEventListener("click",function(){
	self.title="Demo Tables";
	firstView.hide();
	secondView.hide();
});
self.setLeftNavButton(closeBtn);


var addBtn=Ti.UI.createButton({
	width: "150dp",
	top: "50dp",
	height: "50dp",
	title: "Add more data"
})
self.add(addBtn);



var openFirstView=Ti.UI.createButton({
	width: "150dp",
	top: "150dp",
	height: "50dp",
	title: "open All Data"
});
openFirstView.addEventListener("click",function(){
	self.title="First View";
	closeBtn.show();
	firstView.show();
});

self.add(openFirstView);


var openSecondView=Ti.UI.createButton({
	width: "150dp",
	top: "250dp",
	height: "50dp",
	title: "open first data"
});
openSecondView.addEventListener("click",function(){
	self.title="Second View";
	closeBtn.show();
	secondView.show();
});
self.add(openSecondView);


var firstView=require("/childView").createChildView();
self.add(firstView);
firstView.hide();


var secondView=require("/childView").createChildView();
self.add(secondView);
secondView.hide();

var sampleData=require("/childView").createtableData();
firstView.table.setData(sampleData);
secondView.table.appendRow(sampleData);

self.open();

*ChildView.js*
exports.createChildView=function(){
	var self=Ti.UI.createView({
		width: "100%",
		height: "100%",
		backgroundColor: "transparent",
	});
	
	var table=Ti.UI.createTableView({
		minRowHeight: "45dp",
		height: "95%",
		width: "95%",
		style: Ti.UI.iPhone.TableViewStyle.PLAIN
	})
	self.add(table);
	self.table=table;
	
	return self;
}

exports.createtableData=function(){
	var data=[];

	var row1=Ti.UI.createTableViewRow({title: "first row", backgroundColor: "white"});
	row1.add(exports.createPropertiesIcon());
	
	var row2=Ti.UI.createTableViewRow({title: "second row", backgroundColor: "gray"});
	row2.add(exports.createPropertiesIcon());
	
	data.push(row1);
	data.push(row2);
	return data;
}
exports.createPropertiesIcon=function(){
	var self=Ti.UI.createImageView({
		image : '/properties_icon.png',
		right : '8dp', 
		//top: '50dp', 
		height:'50dp',
		width:'50dp'
	});
	self.addEventListener("click",function(){
		alert("hello");
	});
	
	return self;
}

Attachments

FileDateSize
Screen Shot 2013-02-21 at 3.00.42 PM.png2013-02-21T09:35:20.000+000024462
Screen Shot 2013-02-21 at 3.00.54 PM.png2013-02-21T09:35:20.000+000020215

Comments

  1. Carter Lathrop 2013-05-30

    Yes this is still happening on 3.2 CI

JSON Source