Created
June 9, 2011 21:51
-
-
Save pec1985/1017848 to your computer and use it in GitHub Desktop.
Change the table view data with animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow(); | |
var data1 = []; | |
var data2 = []; | |
for (var i=0; i < 70; i++) { | |
data1.push( | |
{title:'data1 - row #'+i} | |
); | |
}; | |
for (var i=0; i < 100; i++) { | |
data2.push( | |
{title:'data2 - row #'+i} | |
); | |
}; | |
var tableView = Ti.UI.createTableView({ | |
data:data1 | |
}); | |
var buttonBar = Ti.UI.createButtonBar({ | |
labels:['one', 'two'] | |
}); | |
buttonBar.addEventListener('click', function(e){ | |
if(e.index === 0){ | |
tableView.setData(data1,{animated:true}); | |
} | |
if(e.index === 1){ | |
tableView.setData(data2,{animated:true}); | |
} | |
}) | |
win.add(tableView); | |
win.rightNavButton = buttonBar; | |
win.open({modal:true}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment