Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-980] alignment not maintain in table view row when row data changes

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:51.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.4.0
ComponentsiOS
Labelsn/a
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:40:41.000+0000
Updated2011-04-17T01:54:51.000+0000

Description

see code - run app, click button - alignment is jacked

//Sample code to illustrate the new table alignment problem introduced in MobileSDK 1.3.0

// this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#000');

// create tab group var tabGroup = Titanium.UI.createTabGroup();

// // create base UI tab and root window // var win1 = Titanium.UI.createWindow({

title:'Tab 1',
backgroundColor:'#fff'

}); var tab1 = Titanium.UI.createTab({

icon:'KS_nav_views.png',
title:'Tab 1',
window:win1

});

var label1 = Titanium.UI.createLabel({

color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'

});

win1.add(label1);

//button test var myButton = Titanium.UI.createButton({

title:'Change Row Data',
top:0,
height:30

}); win1.add(myButton);

myButton.addEventListener('click', function(e) {

Ti.API.debug('myButton click:');
if (e.source.title == 'My Button') {
    Ti.API.debug('  clicked my button');
} else {
    Ti.API.debug('  not interested');
}

});

//table test var data = [];
var section = Ti.UI.createTableViewSection();
data.push(section);
//row1 var row1col1 = Ti.UI.createLabel({

text: 'ROW1',
textAlign: 'Left',
height: 'auto',
width: 'auto',
color: '#000',
left:10,
borderWidth:1,
borderColor:'red'

}); var row1col2 = Ti.UI.createLabel({

text: 'FOO',
textAlign: 'Left',
height: 'auto',
width: 'auto',
color: '#000',
left:100,
borderWidth:1,
borderColor:'red'

}); var row1 = Ti.UI.createTableViewRow({

hasChild: true,
backgroundColor: '#fff'

}); row1.add(row1col1);
row1.add(row1col2);
//row2 var row2col1 = Ti.UI.createLabel({

text: 'ROW2',
textAlign: 'left',
height: 'auto',
width: 'auto',
color: '#000',
left:10,
borderWidth:1,
borderColor:'red'

}); var row2col2 = Ti.UI.createLabel({

text: 'BAR',
textAlign: 'left',
height: 'auto',
width: 'auto',
color: '#000',
left:100,
borderWidth:1,
borderColor:'red'

}); var row2 = Ti.UI.createTableViewRow({

hasChild: true,
backgroundColor: '#fff'

}); row2.add(row2col1);
row2.add(row2col2);
//add rows to section section.add(row1);
section.add(row2);
//tableview var tableview = Ti.UI.createTableView({

data:data,
style:Ti.UI.iPhone.TableViewStyle.GROUPED,
top:35

}); win1.add(tableview);

//add a listener for the button so that we demonstrate the table alignments getting messed up myButton.addEventListener('click', function(e) {

row1col1.text = 0;
row2col1.text = 0;

});

// // create controls tab and root window // var win2 = Titanium.UI.createWindow({

title:'Tab 2',
backgroundColor:'#fff'

}); var tab2 = Titanium.UI.createTab({

icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2

});

var label2 = Titanium.UI.createLabel({

color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'

});

win2.add(label2);

// // add tabs // tabGroup.addTab(tab1);
tabGroup.addTab(tab2);

// open tab group tabGroup.open();

Comments

  1. Nolan Wright 2011-04-15

    Two people are now reporting this

  2. Jeff Haynie 2011-04-15

    (from [905edbe24bd27b5ef2cb63e5975f9e965c7f04dc]) Closes #980 , Closes #990 - our container view should be filling the content view bounds (which has a 0 origin), not the frame, which may not have a 0 origin (IE, when in a grouped view). http://github.com/appcelerator/titanium_mobile/commit/905edbe24bd27b5ef2cb63e5975f9e965c7f04dc"> http://github.com/appcelerator/titanium_mobile/commit/905edbe24bd27...

JSON Source