Created
May 23, 2012 13:31
-
-
Save iskugor/2775243 to your computer and use it in GitHub Desktop.
Titanium: How to append table view section to rendered table view
This file contains hidden or 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
(function() { | |
var win = Ti.UI.createWindow({ backgroundColor: "#f00" }); | |
var table = Ti.UI.createTableView(); | |
var rows = []; | |
for (var i = 0; i < 4; ++i) { | |
rows.push({ title: "Row 0", header: "Header " + i, className: "Row1" }); | |
for (var j = 0; j < 10; j++) { | |
rows.push({ title: "Row " + j, className: "Row2" }); | |
} | |
} | |
table.setData(rows); | |
win.add(table); | |
function appendSection(tableView, sectionTitle) { | |
var sections = tableView.data; | |
sections.push(Ti.UI.createTableViewSection({ headerTitle: sectionTitle })); | |
tableView.setData(sections); | |
} | |
win.addEventListener("open", function() { | |
appendSection(table, "Title"); | |
}); | |
win.open(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment