Skip to content

Instantly share code, notes, and snippets.

@alexburner
Created January 12, 2012 22:53
Show Gist options
  • Save alexburner/1603664 to your computer and use it in GitHub Desktop.
Save alexburner/1603664 to your computer and use it in GitHub Desktop.
Ti 1.8 appendRow issues WORKAROUND
Ti.UI.setBackgroundColor( '#000' );
var rows;
var openButton = Ti.UI.createButton( {
title: 'Open Win'
} );
var win = Ti.UI.createWindow( {
title: 'Root Win',
tabBarHidden: true,
rightNavButton: openButton
} );
var tab = Ti.UI.createTab( {
title: 'Root Tab',
window: win
} );
var grp = Ti.UI.createTabGroup( {
tabs: [ tab ],
zIndex: 0
} );
grp.open();
win.open();
var testWin = Ti.UI.createWindow();
var table = Ti.UI.createTableView();
testWin.add( table );
var open = function () {
reset();
build();
tab.open( testWin, { animated: true } );
};
var reset = function () {
rows = [];
table.setData( [] );
};
var build = function () {
addHead();
addRow();
table.data = rows;
rows = null;
};
var addHead = function () {
var row = Ti.UI.createTableViewRow({
height: 600,
backgroundColor: 'red',
selectionStyle: 'none'
});
rows.push( row );
table.setContentInsets( { top: -600 } );
};
var addRow = function () {
var label = Ti.UI.createLabel({
text: 'I am a row',
width: 'auto',
height: 'auto'
});
var row = Ti.UI.createTableViewRow({
backgroundColor: 'yellow'
});
row.add( label );
rows.push( row );
};
openButton.addEventListener( 'click', open );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment