Reputation: 323
How can i go about adding to an array on button click, i have a table view which is my array, what i want to do is have another piece of data added to that table view when i click a button on another screen. This is how i have made my tableview.
var customTableView = Titanium.UI.createTableView({
BackgroundColor:'White',
style: Titanium.UI.iPhone.TableViewStyle.GROUPED,
search:search,
searchHidden:true,
data:[
{title:"Toms List", value: true},
{title:"Shopping List", value: true},
{title:"Jocelyns List", value: true},
{title:"Friday List", value: true}
]
});
Thanks for any help <3
Upvotes: 0
Views: 339
Reputation: 921
Just to add to @phil comment, you can get your current tableview data, add your new row, then reset the tableview data:
var data = customTableView.data;
data.push({title:"Toms List", value: true});
customTableView.data = data;
Upvotes: 1